summaryrefslogtreecommitdiffabout
path: root/shared.c
Unidiff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/shared.c b/shared.c
index 7def51a..e4595fa 100644
--- a/shared.c
+++ b/shared.c
@@ -92,24 +92,37 @@ void cgit_querystring_cb(const char *name, const char *value)
92 } else if (!strcmp(name, "h")) { 92 } else if (!strcmp(name, "h")) {
93 cgit_query_head = xstrdup(value); 93 cgit_query_head = xstrdup(value);
94 cgit_query_has_symref = 1; 94 cgit_query_has_symref = 1;
95 } else if (!strcmp(name, "id")) { 95 } else if (!strcmp(name, "id")) {
96 cgit_query_sha1 = xstrdup(value); 96 cgit_query_sha1 = xstrdup(value);
97 cgit_query_has_sha1 = 1; 97 cgit_query_has_sha1 = 1;
98 } else if (!strcmp(name, "id2")) { 98 } else if (!strcmp(name, "id2")) {
99 cgit_query_sha2 = xstrdup(value); 99 cgit_query_sha2 = xstrdup(value);
100 cgit_query_has_sha1 = 1; 100 cgit_query_has_sha1 = 1;
101 } else if (!strcmp(name, "ofs")) { 101 } else if (!strcmp(name, "ofs")) {
102 cgit_query_ofs = atoi(value); 102 cgit_query_ofs = atoi(value);
103 } 103 }
104} 104}
105 105
106void *cgit_free_commitinfo(struct commitinfo *info) 106void *cgit_free_commitinfo(struct commitinfo *info)
107{ 107{
108 free(info->author); 108 free(info->author);
109 free(info->author_email); 109 free(info->author_email);
110 free(info->committer); 110 free(info->committer);
111 free(info->committer_email); 111 free(info->committer_email);
112 free(info->subject); 112 free(info->subject);
113 free(info); 113 free(info);
114 return NULL; 114 return NULL;
115} 115}
116
117int hextoint(char c)
118{
119 if (c >= 'a' && c <= 'f')
120 return 10 + c - 'a';
121 else if (c >= 'A' && c <= 'F')
122 return 10 + c - 'A';
123 else if (c >= '0' && c <= '9')
124 return c - '0';
125 else
126 return -1;
127}
128