Default LISTING_LHS_WIDTH to depend on LISTING_WORD_SIZE so that bytes per
[binutils.git] / gprof / search_list.c
blobd475dbf6a483e72bd30c5306ea9b0b4429c24a7a
1 #include "libiberty.h"
2 #include "gprof.h"
3 #include "search_list.h"
6 void
7 DEFUN (search_list_append, (list, paths),
8 Search_List * list AND const char *paths)
10 Search_List_Elem *new_el;
11 const char *beg, *colon;
12 int len;
14 colon = paths - 1;
17 beg = colon + 1;
18 colon = strchr (beg, ':');
19 if (colon)
21 len = colon - beg;
23 else
25 len = strlen (beg);
27 new_el = (Search_List_Elem *) xmalloc (sizeof (*new_el) + len);
28 memcpy (new_el->path, beg, len);
29 new_el->path[len] = '\0';
31 /* append new path at end of list: */
32 new_el->next = 0;
33 if (list->tail)
35 list->tail->next = new_el;
37 else
39 list->head = new_el;
41 list->tail = new_el;
43 while (colon);