diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2014-01-25 00:07:30 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2014-01-25 00:07:30 +0000 |
commit | d7ca0c3e555ef0b5250873ddce48ccf2326b017a (patch) | |
tree | 52fc801f0893eb7752524b2602d420afbda4ed59 /llist.c | |
parent | 3645c236e9720deb696e7aebc33cd9a6d8cbbdc6 (diff) | |
download | wavemon-d7ca0c3e555ef0b5250873ddce48ccf2326b017a.tar.gz |
Imported Upstream version 0.7.6upstream/0.7.6
Diffstat (limited to '')
-rw-r--r-- | llist.c | 49 |
1 files changed, 1 insertions, 48 deletions
@@ -33,7 +33,7 @@ * c = char * f = float * s = char * - * S = char *, case-insensitive and fuzzy (for ll_scan) + * S = char *, case-insensitive and fuzzy * * = void * */ @@ -75,7 +75,6 @@ static llist *arg2element(char type, va_list * ap, llist * next) *((double *)l->e) = va_arg(*ap, double); break; case '*': - l->e = (void *)malloc(sizeof(void *)); l->e = va_arg(*ap, void *); } l->next = next; @@ -199,52 +198,6 @@ void ll_replace(int ld, unsigned long n, const char *format, ...) } /* - * return the position of a given element in list (or -1) - */ -signed long ll_scan(int ld, const char *format, ...) -{ - llist *l = lists[ld]; - va_list ap; - int len, i, rv = -1, int_v; - double double_v; - char *string_v; - - va_start(ap, format); - switch (*format) { - case 'd': - int_v = va_arg(ap, int); - for (i = 0; (l = l->next); i++) - if (*(int *)l->e == int_v) - rv = i; - break; - case 'f': - double_v = va_arg(ap, double); - for (i = 0; (l = l->next); i++) - if (*(double *)l->e == double_v) - rv = i; - break; - case 's': - string_v = strdup(va_arg(ap, char *)); - for (i = 0; (l = l->next); i++) - if (!strcmp(l->e, string_v)) - rv = i; - free(string_v); - break; - case 'S': - string_v = strdup(va_arg(ap, char *)); - len = strlen(string_v); - for (i = 0; (l = l->next); i++) - if (strncasecmp(l->e, string_v, len) == 0) { - rv = i; - break; - } - free(string_v); - } - va_end(ap); - return rv; -} - -/* * return the number of elements in a given list */ unsigned long ll_size(int ld) |