aboutsummaryrefslogtreecommitdiff
path: root/src/preproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/preproc.c')
-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.