diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-04-30 12:06:47 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-04-30 12:06:47 +0300 |
commit | bd4a203ab453d78e87e29d11017b35248c9babca (patch) | |
tree | 739ddb735fdfb6aaf668ca1b2ff994004e63d6a0 /src/preproc.c | |
parent | 3f02a6139ea4ed7635453cbcdd600e815a5c2208 (diff) | |
download | grecs-bd4a203ab453d78e87e29d11017b35248c9babca.tar.gz grecs-bd4a203ab453d78e87e29d11017b35248c9babca.tar.bz2 |
Remove dependency on xlists.
* gnulib.modules (linked-list, xlist): Remove.
* src/list.c: New file.
* src/Makefile.am (libgrecs_a_SOURCES): Add list.c
* src/grecs-gram.y: Use grecs_list functions.
* src/preproc.c: Likewise.
* src/grecs.h (grecs_list_entry, grecs_list): New structs.
(grecs_value): use struct grecs_list* for the v.list member.
(grecs_log_to_stderr): Change type to int.
(grecs_list_create, grecs_list_size, grecs_list_push)
(grecs_list_pop, grecs_list_locate, grecs_list_index)
(grecs_list_remove_tail): New protos.
Diffstat (limited to 'src/preproc.c')
-rw-r--r-- | src/preproc.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/src/preproc.c b/src/preproc.c index 0723a2e..9cdea3c 100644 --- a/src/preproc.c +++ b/src/preproc.c @@ -33,3 +33,2 @@ #include <hash.h> -#include <gl_linked_list.h> #include <inttostr.h> @@ -44,3 +43,3 @@ -bool grecs_log_to_stderr = 1; +int grecs_log_to_stderr = 1; void (*grecs_log_setup_hook) () = NULL; @@ -243,4 +242,4 @@ ctx_lookup (struct stat *st) const char *grecs_preprocessor = NULL; -static gl_list_t include_path; -static gl_list_t std_include_path; +static struct grecs_list *include_path; +static struct grecs_list *std_include_path; @@ -256,10 +255,9 @@ struct file_data static int -pp_list_find (gl_list_t list, struct file_data *dptr) +pp_list_find (struct grecs_list *list, struct file_data *dptr) { - const void *p; - gl_list_iterator_t itr = gl_list_iterator (list); + struct grecs_list_entry *ep; - while (!dptr->found && gl_list_iterator_next (&itr, &p, NULL)) + for (ep = list->head; !dptr->found && ep; ep = ep->next) { - const char *dir = p; + const char *dir = ep->data; size_t size = strlen (dir) + 1 + dptr->namelen + 1; @@ -275,3 +273,2 @@ pp_list_find (gl_list_t list, struct file_data *dptr) } - gl_list_iterator_free (&itr); return dptr->found; @@ -279,12 +276,2 @@ pp_list_find (gl_list_t list, struct file_data *dptr) -gl_list_t -pp_list_create () -{ - return gl_list_create_empty(&gl_linked_list_implementation, - NULL, - NULL, - NULL, - false); -} - void @@ -293,4 +280,4 @@ grecs_include_path_setup_v (char **dirs) if (!include_path) - include_path = pp_list_create (); - std_include_path = pp_list_create (); + include_path = grecs_list_create (); + std_include_path = grecs_list_create (); if (dirs) @@ -300,3 +287,3 @@ grecs_include_path_setup_v (char **dirs) /* FIXME: Element never freed */ - gl_list_add_last (std_include_path, xstrdup (dirs[i])); + grecs_list_append (std_include_path, xstrdup (dirs[i])); } @@ -337,4 +324,4 @@ grecs_preproc_add_include_dir (char *dir) if (!include_path) - include_path = pp_list_create (); - gl_list_add_last (include_path, dir); + include_path = grecs_list_create (); + grecs_list_append (include_path, dir); } @@ -510,5 +497,5 @@ try_file (const char *name, int allow_cwd, int err_not_found, char **newp) { - gl_list_node_t node = gl_list_add_last (include_path, cwd); + grecs_list_append (include_path, cwd); pp_list_find (include_path, &fd); - gl_list_remove_node (include_path, node); + grecs_list_remove_tail (include_path); } |