diff options
-rw-r--r-- | src/about.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/about.c b/src/about.c index c668b94..47d0c5b 100644 --- a/src/about.c +++ b/src/about.c @@ -19,8 +19,6 @@ * along with Marquee. If not, see <http://www.gnu.org/licenses/>. */ -#define _POSIX_C_SOURCE 200809L - #include <string.h> #include <webkit2/webkit2.h> @@ -33,18 +31,28 @@ static GHashTable * parse_query_string(gchar *str) { GHashTable *hash_table; - gboolean first; - gchar *saveptr; gchar *key; gchar *val; hash_table = g_hash_table_new(g_str_hash, g_str_equal); - first = TRUE; - while ((key = strtok_r(first ? str : NULL, "=", &saveptr))) { - first = FALSE; - val = strtok_r(NULL, "&", &saveptr); + while (*str) { + key = str; + for (; *str && *str != '='; ++str); + if (!*str) { + g_hash_table_insert(hash_table, key, NULL); + break; + } + *str = '\0'; + val = ++str; + for (; *str && *str != '&'; ++str); + if (!*str) { + g_hash_table_insert(hash_table, key, val); + break; + } + *str = '\0'; g_hash_table_insert(hash_table, key, val); + ++str; } return hash_table; |