]> granicus.if.org Git - sysstat/commitdiff
sa_common.c: Fix pointer signedness difference warning from gcc
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 20 Jul 2018 07:00:42 +0000 (09:00 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 20 Jul 2018 07:00:42 +0000 (09:00 +0200)
Remove "unsigned" attribute to avoid warning from gcc:

sa_common.c: In function ‘add_list_item’:
sa_common.c:2516:20: warning: pointer targets in assignment from ‘unsigned char *’ to ‘char *’ differ in signedness [-Wpointer-sign]
  if ((e->item_name = (unsigned char *) malloc(len + 1)) == NULL) {
                    ^

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa_common.c

index ecb4c677bed774e5af173c8ed70f54e570f0d582..97265299651135d56015fc53048d13b3afbddf7e 100644 (file)
@@ -2513,7 +2513,7 @@ int add_list_item(struct sa_item **list, char *item_name, int max_len)
        /* Item not found: Add it to the list */
        SREALLOC(*list, struct sa_item, sizeof(struct sa_item));
        e = *list;
-       if ((e->item_name = (unsigned char *) malloc(len + 1)) == NULL) {
+       if ((e->item_name = (char *) malloc(len + 1)) == NULL) {
                perror("malloc");
                exit(4);
        }