author | Lars Hjemli <hjemli@gmail.com> | 2006-12-11 15:11:40 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-11 15:11:40 (UTC) |
commit | 51ada4fda2b47710351e6e4da8a95807d6d9f729 (patch) (unidiff) | |
tree | 48b543fd16b666db7024038506ffc4eadb0ca966 | |
parent | 318d106300102c19d114a4ea89265b0a4060d9cb (diff) | |
download | cgit-51ada4fda2b47710351e6e4da8a95807d6d9f729.zip cgit-51ada4fda2b47710351e6e4da8a95807d6d9f729.tar.gz cgit-51ada4fda2b47710351e6e4da8a95807d6d9f729.tar.bz2 |
Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | cgit.c | 26 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | parsing.c (renamed from config.c) | 25 |
4 files changed, 29 insertions, 28 deletions
@@ -7,3 +7,3 @@ CACHE_ROOT = /var/cache/cgit | |||
7 | EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto | 7 | EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto |
8 | OBJECTS = config.o html.o cache.o | 8 | OBJECTS = parsing.o html.o cache.o |
9 | 9 | ||
@@ -19,3 +19,4 @@ install: all | |||
19 | cgit: cgit.c cgit.h git.h $(OBJECTS) | 19 | cgit: cgit.c cgit.h git.h $(OBJECTS) |
20 | $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit $(OBJECTS) $(EXTLIBS) | 20 | $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \ |
21 | $(OBJECTS) $(EXTLIBS) | ||
21 | 22 | ||
@@ -55,28 +55,2 @@ struct cacheitem cacheitem; | |||
55 | 55 | ||
56 | int cgit_parse_query(char *txt, configfn fn) | ||
57 | { | ||
58 | char *t, *value = NULL, c; | ||
59 | |||
60 | if (!txt) | ||
61 | return 0; | ||
62 | |||
63 | t = txt = xstrdup(txt); | ||
64 | |||
65 | while((c=*t) != '\0') { | ||
66 | if (c=='=') { | ||
67 | *t = '\0'; | ||
68 | value = t+1; | ||
69 | } else if (c=='&') { | ||
70 | *t = '\0'; | ||
71 | (*fn)(txt, value); | ||
72 | txt = t+1; | ||
73 | value = NULL; | ||
74 | } | ||
75 | t++; | ||
76 | } | ||
77 | if (t!=txt) | ||
78 | (*fn)(txt, value); | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | void cgit_global_config_cb(const char *name, const char *value) | 56 | void cgit_global_config_cb(const char *name, const char *value) |
@@ -58,2 +58,3 @@ extern void html_link_close(void); | |||
58 | extern int cgit_read_config(const char *filename, configfn fn); | 58 | extern int cgit_read_config(const char *filename, configfn fn); |
59 | extern int cgit_parse_query(char *txt, configfn fn); | ||
59 | 60 | ||
@@ -81 +81,26 @@ int cgit_read_config(const char *filename, configfn fn) | |||
81 | 81 | ||
82 | int cgit_parse_query(char *txt, configfn fn) | ||
83 | { | ||
84 | char *t, *value = NULL, c; | ||
85 | |||
86 | if (!txt) | ||
87 | return 0; | ||
88 | |||
89 | t = txt = xstrdup(txt); | ||
90 | |||
91 | while((c=*t) != '\0') { | ||
92 | if (c=='=') { | ||
93 | *t = '\0'; | ||
94 | value = t+1; | ||
95 | } else if (c=='&') { | ||
96 | *t = '\0'; | ||
97 | (*fn)(txt, value); | ||
98 | txt = t+1; | ||
99 | value = NULL; | ||
100 | } | ||
101 | t++; | ||
102 | } | ||
103 | if (t!=txt) | ||
104 | (*fn)(txt, value); | ||
105 | return 0; | ||
106 | } | ||