this changes link behaviour and those functions are not exported to other
files when some c code is linked against our code
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
static char buf[BUFSIZE + 1];
static size_t offset = 0;
static char buf[BUFSIZE + 1];
static size_t offset = 0;
-uint64_t get_timestamp(sd_journal *j) {
+static uint64_t get_timestamp(sd_journal *j) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
-void print_to_buf(const char * string, uint32_t length) {
+static void print_to_buf(const char * string, uint32_t length) {
-void print_cursor(sd_journal *j) {
+static void print_cursor(sd_journal *j) {
int r;
char *cursor = NULL;
r = sd_journal_get_cursor(j, &cursor);
int r;
char *cursor = NULL;
r = sd_journal_get_cursor(j, &cursor);
-void print_first_cursor(sd_journal *j) {
+static void print_first_cursor(sd_journal *j) {
static bool printed_first_cursor = false;
if (!printed_first_cursor) {
print_cursor(j);
static bool printed_first_cursor = false;
if (!printed_first_cursor) {
print_cursor(j);
-void print_reboot(sd_journal *j) {
+static void print_reboot(sd_journal *j) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_BOOT_ID", (const void **)&d, &l);
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_BOOT_ID", (const void **)&d, &l);
-void print_timestamp(sd_journal *j) {
+static void print_timestamp(sd_journal *j) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
uint64_t timestamp;
int r = sd_journal_get_realtime_usec(j, ×tamp);
if (r < 0) {
print_to_buf(timestring, 15);
}
print_to_buf(timestring, 15);
}
-void print_pid(sd_journal *j) {
+static void print_pid(sd_journal *j) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_PID", (const void **)&d, &l);
const char *d;
size_t l;
int r = sd_journal_get_data(j, "_PID", (const void **)&d, &l);
-bool print_field(sd_journal *j, const char *field) {
+static bool print_field(sd_journal *j, const char *field) {
const char *d;
size_t l;
int r = sd_journal_get_data(j, field, (const void **)&d, &l);
const char *d;
size_t l;
int r = sd_journal_get_data(j, field, (const void **)&d, &l);
-void print_line(sd_journal *j) {
+static void print_line(sd_journal *j) {
print_reboot(j);
print_timestamp(j);
print_to_buf(" ", 1);
print_reboot(j);
print_timestamp(j);
print_to_buf(" ", 1);
-void usage(char *error) {
+_Noreturn static void usage(char *error) {
if (error) {
fprintf(stderr, "ERROR: %s\n", error);
}
if (error) {
fprintf(stderr, "ERROR: %s\n", error);
}
break;
case 'h':
usage(NULL);
break;
case 'h':
usage(NULL);
case '?':
default:
usage("invalid option or missing argument");
case '?':
default:
usage("invalid option or missing argument");