aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--cgit.c26
-rw-r--r--cgit.h1
-rw-r--r--config.c (renamed from parsing.c)25
4 files changed, 28 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index eab7926..c71e39c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ INSTALL_CSS = /var/www/htdocs/cgit.css
CACHE_ROOT = /var/cache/cgit
EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto
-OBJECTS = parsing.o html.o cache.o
+OBJECTS = config.o html.o cache.o
CFLAGS += -Wall
@@ -17,8 +17,7 @@ install: all
rm -rf $(CACHE_ROOT)/*
cgit: cgit.c cgit.h git.h $(OBJECTS)
- $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \
- $(OBJECTS) $(EXTLIBS)
+ $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit $(OBJECTS) $(EXTLIBS)
$(OBJECTS): cgit.h git.h
diff --git a/cgit.c b/cgit.c
index 5567859..dc91125 100644
--- a/cgit.c
+++ b/cgit.c
@@ -53,6 +53,32 @@ char *cgit_query_sha1 = NULL;
struct cacheitem cacheitem;
+int cgit_parse_query(char *txt, configfn fn)
+{
+ char *t, *value = NULL, c;
+
+ if (!txt)
+ return 0;
+
+ t = txt = xstrdup(txt);
+
+ while((c=*t) != '\0') {
+ if (c=='=') {
+ *t = '\0';
+ value = t+1;
+ } else if (c=='&') {
+ *t = '\0';
+ (*fn)(txt, value);
+ txt = t+1;
+ value = NULL;
+ }
+ t++;
+ }
+ if (t!=txt)
+ (*fn)(txt, value);
+ return 0;
+}
+
void cgit_global_config_cb(const char *name, const char *value)
{
if (!strcmp(name, "root"))
diff --git a/cgit.h b/cgit.h
index 6c0aa3b..7e4bfef 100644
--- a/cgit.h
+++ b/cgit.h
@@ -56,7 +56,6 @@ extern void html_link_close(void);
extern int cgit_read_config(const char *filename, configfn fn);
-extern int cgit_parse_query(char *txt, configfn fn);
extern void cache_prepare(struct cacheitem *item);
extern int cache_lock(struct cacheitem *item);
diff --git a/parsing.c b/config.c
index 98b3243..871edf2 100644
--- a/parsing.c
+++ b/config.c
@@ -79,28 +79,3 @@ int cgit_read_config(const char *filename, configfn fn)
return ret;
}
-int cgit_parse_query(char *txt, configfn fn)
-{
- char *t, *value = NULL, c;
-
- if (!txt)
- return 0;
-
- t = txt = xstrdup(txt);
-
- while((c=*t) != '\0') {
- if (c=='=') {
- *t = '\0';
- value = t+1;
- } else if (c=='&') {
- *t = '\0';
- (*fn)(txt, value);
- txt = t+1;
- value = NULL;
- }
- t++;
- }
- if (t!=txt)
- (*fn)(txt, value);
- return 0;
-}