]> git.ipfire.org Git - thirdparty/lldpd.git/blobdiff - src/marshal.c
debian: no need to BD on lsb-release anymore
[thirdparty/lldpd.git] / src / marshal.c
index 8a57d30528421462d1eeb5446adf88dd9a6227b5..0cde547c401266289fdee6f0a56bf645fe6ca8c8 100644 (file)
@@ -15,7 +15,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define _GNU_SOURCE 1
 #define MARSHAL_EXPORT
 #include "marshal.h"
 
@@ -64,7 +63,7 @@ struct marshal_info marshal_info_ignore = {
 struct ref {
        TAILQ_ENTRY(ref) next;
        void *pointer;
-       int dummy;              /* To renumerate pointers */
+       uintptr_t dummy;        /* To renumerate pointers */
 };
 TAILQ_HEAD(ref_l, ref);
 
@@ -79,7 +78,7 @@ marshal_serialize_(struct marshal_info *mi, void *unserialized, void **input,
        size_t len;
        struct marshal_subinfo *current;
        struct marshal_serialized *new = NULL, *serialized = NULL;
-       int dummy = 1;
+       uintptr_t dummy = 1;
 
        log_debug("marshal", "start serialization of %s", mi->name);
 
@@ -102,6 +101,7 @@ marshal_serialize_(struct marshal_info *mi, void *unserialized, void **input,
        /* Handle special cases. */
        size = mi->size;
        if (!strcmp(mi->name, "null string"))
+               /* We know we can't be called with NULL */
                size = strlen((char *)unserialized) + 1;
        else if (!strcmp(mi->name, "fixed string"))
                size = osize;
@@ -116,7 +116,7 @@ marshal_serialize_(struct marshal_info *mi, void *unserialized, void **input,
                goto marshal_error;
        }
        /* We don't use the original pointer but a dummy one. */
-       serialized->orig = (unsigned char*)NULL + dummy;
+       serialized->orig = (unsigned char*)dummy;
 
        /* Append the new reference */
        if (!(cref = calloc(1, sizeof(struct ref)))) {
@@ -163,7 +163,7 @@ marshal_serialize_(struct marshal_info *mi, void *unserialized, void **input,
                if (current->kind == pointer && !skip) {
                        TAILQ_FOREACH(cref, refs, next) {
                                if (source == cref->pointer) {
-                                       void *fakepointer = (unsigned char*)NULL + cref->dummy;
+                                       void *fakepointer = (unsigned char*)cref->dummy;
                                        memcpy((unsigned char *)serialized->object + current->offset,
                                            &fakepointer, sizeof(void *));
                                        break;