Parcourir la source

Merge branch 'maint'

* maint:
  Drop -fno-strict-aliasing
  Simplify using xtra_key with a union rather than a cast
Bryan Drewery il y a 8 ans
Parent
commit
f1883265e6
4 fichiers modifiés avec 15 ajouts et 14 suppressions
  1. 1 1
      build/autotools/includes/depend.m4
  2. 1 1
      configure
  3. 6 6
      src/userent.cc
  4. 7 6
      src/users.h

+ 1 - 1
build/autotools/includes/depend.m4

@@ -11,7 +11,7 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Wno-format-y2k"
+  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -Wno-format-y2k"
   GCC3_CXXFLAGS="-Woverloaded-virtual"
   GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi

+ 1 - 1
configure

@@ -4251,7 +4251,7 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Wno-format-y2k"
+  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -Wno-format-y2k"
   GCC3_CXXFLAGS="-Woverloaded-virtual"
   GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi

+ 6 - 6
src/userent.cc

@@ -242,7 +242,7 @@ struct user_entry_type USERENTRY_ADDED = {
 
 static bool set_set(struct userrec *u, struct user_entry *e, void *buf)
 {
-  struct xtra_key *curr = (struct xtra_key *) e->u.extra, 
+  struct xtra_key *curr = e->u.xk,
                   *newxk = (struct xtra_key *) buf, *old = NULL;
 
   /* find the curr key if it exists */
@@ -285,7 +285,7 @@ static bool set_set(struct userrec *u, struct user_entry *e, void *buf)
 
   /* add the new entry if it's not empty */
   if ((!old || old != newxk) && newxk->data && newxk->data[0]) {
-    list_insert((struct xtra_key **) (&e->u.extra), newxk);
+    list_insert((&e->u.xk), newxk);
   } else {
     free(newxk->data);
     free(newxk->key);
@@ -311,7 +311,7 @@ static bool set_unpack(struct userrec *u, struct user_entry *e)
       t = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
       t->key = strdup(key);
       t->data = strdup(data);
-      list_insert((struct xtra_key **) (&e->u.extra), t);
+      list_insert((&e->u.xk), t);
     }
     curr = curr->next;
   }
@@ -323,7 +323,7 @@ static bool set_unpack(struct userrec *u, struct user_entry *e)
 static void set_display(int idx, struct user_entry *e, struct userrec *u)
 {
   if (conf.bot->hub) {
-    struct xtra_key *xk = (struct xtra_key *) e->u.extra;
+    struct xtra_key *xk = e->u.xk;
     struct flag_record fr = {FR_GLOBAL, 0, 0, 0 };
 
     dprintf(idx, "  BOTSET:\n");
@@ -358,7 +358,7 @@ static bool set_gotshare(struct userrec *u, struct user_entry *e, char *buf, int
 static void set_write_userfile(bd::Stream& stream, const struct userrec *u, const struct user_entry *e, int idx)
 {
   int localhub = nextbot(u->handle);
-  struct xtra_key *x = (struct xtra_key *) e->u.extra;
+  struct xtra_key *x = e->u.xk;
 
   for (; x; x = x->next) {
     /*
@@ -376,7 +376,7 @@ static void set_write_userfile(bd::Stream& stream, const struct userrec *u, cons
 
 static bool set_kill(struct user_entry *e)
 {
-  struct xtra_key *x = (struct xtra_key *) e->u.extra, *y = NULL;
+  struct xtra_key *x = e->u.xk, *y = NULL;
 
   for (; x; x = y) {
     y = x->next;

+ 7 - 6
src/users.h

@@ -66,24 +66,25 @@ struct bot_addr {
   in_port_t relay_port;
 };
 
+struct xtra_key {
+  struct xtra_key *next;
+  char *key;
+  char *data;
+};
+
 struct user_entry {
   struct user_entry *next;
   struct user_entry_type *type;
   union {
     char *string;
     void *extra;
+    struct xtra_key *xk;
     struct list_type *list;
     unsigned long ulong;
   } u;
   char *name;
 };
 
-struct xtra_key {
-  struct xtra_key *next;
-  char *key;
-  char *data;
-};
-
 struct filesys_stats {
   int uploads;
   int upload_ks;