summaryrefslogtreecommitdiffabout
path: root/src/preproc.c
authorSergey Poznyakoff <gray@gnu.org.ua>2011-04-30 09:06:47 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-04-30 09:06:47 (GMT)
commitbd4a203ab453d78e87e29d11017b35248c9babca (patch) (side-by-side diff)
tree739ddb735fdfb6aaf668ca1b2ff994004e63d6a0 /src/preproc.c
parent3f02a6139ea4ed7635453cbcdd600e815a5c2208 (diff)
downloadgrecs-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') (more/less context) (ignore whitespace changes)
-rw-r--r--src/preproc.c41
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
@@ -31,7 +31,6 @@
#include <xalloc.h>
#include <hash.h>
-#include <gl_linked_list.h>
#include <inttostr.h>
#include <wordsplit.h>
@@ -42,7 +41,7 @@
# define _(msgid) msgid
#endif
-bool grecs_log_to_stderr = 1;
+int grecs_log_to_stderr = 1;
void (*grecs_log_setup_hook) () = NULL;
struct input_file_ident
@@ -241,8 +240,8 @@ 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;
struct file_data
{
@@ -254,14 +253,13 @@ 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;
if (size > dptr->buflen)
{
@@ -273,32 +271,21 @@ pp_list_find (gl_list_t list, struct file_data *dptr)
strcat (dptr->buf, dptr->name);
dptr->found = access (dptr->buf, F_OK) == 0;
}
- gl_list_iterator_free (&itr);
return dptr->found;
}
-gl_list_t
-pp_list_create ()
-{
- return gl_list_create_empty(&gl_linked_list_implementation,
- NULL,
- NULL,
- NULL,
- false);
-}
-
void
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)
{
int i;
for (i = 0; dirs[i]; i++)
/* FIXME: Element never freed */
- gl_list_add_last (std_include_path, xstrdup (dirs[i]));
+ grecs_list_append (std_include_path, xstrdup (dirs[i]));
}
}
@@ -335,8 +322,8 @@ void
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);
}
static Hash_table *incl_sources;
@@ -508,9 +495,9 @@ try_file (const char *name, int allow_cwd, int err_not_found, char **newp)
grecs_include_path_setup (NULL);
if (allow_cwd)
{
- 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);
}
else
pp_list_find (include_path, &fd);

Return to:

Send suggestions and report system problems to the System administrator.