[systemd-commits] 2 commits - src/getty-generator.c src/hashmap.c src/journal src/log.c src/macro.h src/mount.c src/util.c

Lennart Poettering lennart at kemper.freedesktop.org
Mon Mar 5 06:07:31 PST 2012


 src/getty-generator.c      |    2 +-
 src/hashmap.c              |    4 ++--
 src/journal/journal-file.c |    8 ++++----
 src/log.c                  |    4 ++--
 src/macro.h                |    1 +
 src/mount.c                |    2 +-
 src/util.c                 |    4 ++--
 7 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 6a39419fe4e4ab7beb2412b6a52b5fd513509452
Author: Frederic Crozat <fcrozat at suse.com>
Date:   Wed Feb 29 14:42:49 2012 +0100

    fix sparse warnings

diff --git a/src/getty-generator.c b/src/getty-generator.c
index 1263785..7fac43a 100644
--- a/src/getty-generator.c
+++ b/src/getty-generator.c
@@ -28,7 +28,7 @@
 #include "unit-name.h"
 #include "virt.h"
 
-const char *arg_dest = "/tmp";
+static const char *arg_dest = "/tmp";
 
 static int add_symlink(const char *fservice, const char *tservice) {
         char *from = NULL, *to = NULL;
diff --git a/src/hashmap.c b/src/hashmap.c
index 7ef8097..6928118 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -55,10 +55,10 @@ struct pool {
         unsigned n_used;
 };
 
-struct pool *first_hashmap_pool = NULL;
+static struct pool *first_hashmap_pool = NULL;
 static void *first_hashmap_tile = NULL;
 
-struct pool *first_entry_pool = NULL;
+static struct pool *first_entry_pool = NULL;
 static void *first_entry_tile = NULL;
 
 static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
diff --git a/src/log.c b/src/log.c
index c37ab22..e1f511c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -625,11 +625,11 @@ _noreturn_ static void log_assert(const char *text, const char *file, int line,
 }
 #pragma GCC diagnostic pop
 
-void log_assert_failed(const char *text, const char *file, int line, const char *func) {
+_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func) {
         log_assert(text, file, line, func, "Assertion '%s' failed at %s:%u, function %s(). Aborting.");
 }
 
-void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func) {
+_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func) {
         log_assert(text, file, line, func, "Code should not be reached '%s' at %s:%u, function %s(). Aborting.");
 }
 
diff --git a/src/macro.h b/src/macro.h
index 58de001..19f259e 100644
--- a/src/macro.h
+++ b/src/macro.h
@@ -23,6 +23,7 @@
 ***/
 
 #include <assert.h>
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <inttypes.h>
diff --git a/src/mount.c b/src/mount.c
index 0ae964b..f80fcf5 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -271,7 +271,7 @@ static char* mount_test_option(const char *haystack, const char *needle) {
          * struct mntent */
 
         if (!haystack)
-                return false;
+                return NULL;
 
         zero(me);
         me.mnt_opts = (char*) haystack;
diff --git a/src/util.c b/src/util.c
index e9869ea..bf22f57 100644
--- a/src/util.c
+++ b/src/util.c
@@ -892,7 +892,7 @@ int load_env_file(
                 char ***rl) {
 
         FILE *f;
-        char **m = 0;
+        char **m = NULL;
         int r;
 
         assert(fname);
@@ -4177,7 +4177,7 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
 
 }
 
-void freeze(void) {
+_noreturn_ void freeze(void) {
 
         /* Make sure nobody waits for us on a socket anymore */
         close_all_fds(NULL, 0);

commit 7be3aa1732f76245b58f8cdfe74707f8f7f67d18
Author: Frederic Crozat <fcrozat at suse.com>
Date:   Thu Mar 1 18:00:01 2012 +0100

    journal: fix endianness errors

diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 275caea..90aa27e 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -771,14 +771,14 @@ static int journal_file_append_data(JournalFile *f, const void *data, uint64_t s
 
 uint64_t journal_file_entry_n_items(Object *o) {
         assert(o);
-        assert(o->object.type == htole64(OBJECT_ENTRY));
+        assert(o->object.type == OBJECT_ENTRY);
 
         return (le64toh(o->object.size) - offsetof(Object, entry.items)) / sizeof(EntryItem);
 }
 
 static uint64_t journal_file_entry_array_n_items(Object *o) {
         assert(o);
-        assert(o->object.type == htole64(OBJECT_ENTRY_ARRAY));
+        assert(o->object.type == OBJECT_ENTRY_ARRAY);
 
         return (le64toh(o->object.size) - offsetof(Object, entry_array.items)) / sizeof(uint64_t);
 }
@@ -833,7 +833,7 @@ static int link_entry_into_array(JournalFile *f,
         o->entry_array.items[i] = htole64(p);
 
         if (ap == 0)
-                *first = q;
+                *first = htole64(q);
         else {
                 r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, ap, &o);
                 if (r < 0)
@@ -866,7 +866,7 @@ static int link_entry_into_array_plus_one(JournalFile *f,
         else {
                 uint64_t i;
 
-                i = le64toh(*idx) - 1;
+                i = htole64(le64toh(*idx) - 1);
                 r = link_entry_into_array(f, first, &i, p);
                 if (r < 0)
                         return r;



More information about the systemd-commits mailing list