summaryrefslogtreecommitdiffabout
path: root/lib
authorSergey Poznyakoff <gray@gnu.org.ua>2018-03-15 11:29:52 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2018-03-15 12:12:23 (GMT)
commit58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2 (patch) (side-by-side diff)
tree01fcd1416af582e2429f0ae8d120e2af39b8f9d9 /lib
parent677473cdfc42b9fd83623902e80de946f108825c (diff)
downloadeclat-58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2.tar.gz
eclat-58a8936d30bbb18b8ad93fecfe3fe2210d1c18b2.tar.bz2
Upgrade grecs
* grecs: pull * configure.ac: Enable json * lib/Makefile.am (AM_CPPFLAGS): Use @GRECS_INCLUDES@ (libeclat_a_SOURCES): Remove json sources. * src/Makefile.am (AM_CPPFLAGS): Use @GRECS_INCLUDES@ * tests/Makefile.am: Likewise. * lib/json.h: Remove. * lib/jsongrm.y: Remove. * lib/jsonlex.l: Remove. * tests/tjson.c: Remove. * src/config.c (eclat_kw): Mark statically initialized memory locations as such. * src/mktags.c (process_tags): Use wordsplit to process quoted arguments. * lib/bidimap.c (bidimap_config): Fill allocated memory with 0's * lib/filemap.c (filemap_config): Likewise. * lib/gdbmmap.c (gdbm_map_config): Likewise. * lib/seqmap.c (seqmap_config): Likewise.
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/Makefile.am11
-rw-r--r--lib/bidimap.c4
-rw-r--r--lib/filemap.c4
-rw-r--r--lib/forlangrm.y4
-rw-r--r--lib/forlanlex.l15
-rw-r--r--lib/gdbmmap.c4
-rw-r--r--lib/json.h66
-rw-r--r--lib/jsongrm.y316
-rw-r--r--lib/jsonlex.l183
-rw-r--r--lib/map.c6
-rw-r--r--lib/req2url.c6
-rw-r--r--lib/reqcreat.c2
-rw-r--r--lib/reqencode.c4
-rw-r--r--lib/reqsign.c8
-rw-r--r--lib/seqmap.c4
15 files changed, 34 insertions, 603 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 711bc98..e1ed1c3 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of Eclat
-# Copyright (C) 2012-2015 Sergey Poznyakoff
+# Copyright (C) 2012-2018 Sergey Poznyakoff
#
# Eclat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,10 +43,6 @@ libeclat_a_SOURCES=\
forlangrm.y\
forlanlex.l\
istore.c\
- json.h\
- jsongrm.h\
- jsongrm.y\
- jsonlex.l\
getans.c\
getyn.c\
hmac_sha1.c\
@@ -71,14 +67,11 @@ libeclat_a_SOURCES=\
$(maps)
AM_LDFLAGS = $(CURL_LIBS)
-AM_CPPFLAGS = -I$(top_srcdir)/grecs/src/ $(CURL_CFLAGS)
+AM_CPPFLAGS = @GRECS_INCLUDES@ $(CURL_CFLAGS)
forlanlex.c: forlangrm.h
forlangrm.c forlangrm.h: forlangrm.y
-jsonlex.c: jsongrm.h
-jsongrm.c jsongrm.h: jsongrm.y
-
AM_YFLAGS=-tdv
AM_LFLAGS=-dp
diff --git a/lib/bidimap.c b/lib/bidimap.c
index fc601c8..aafc736 100644
--- a/lib/bidimap.c
+++ b/lib/bidimap.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -100,7 +100,7 @@ bidimap_config(int dbg, struct grecs_node *node, void *data)
struct bidimap *map, **return_map = data;
int i;
- map = grecs_malloc(sizeof(*map));
+ map = grecs_zalloc(sizeof(*map));
for (i = 0; bidimap_kw[i].ident; i++)
bidimap_kw[i].varptr = map;
if (grecs_tree_process(node->down, bidimap_kw)) {
diff --git a/lib/filemap.c b/lib/filemap.c
index 6c5e286..26582ec 100644
--- a/lib/filemap.c
+++ b/lib/filemap.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ filemap_config(int dbg, struct grecs_node *node, void *data)
int i;
struct grecs_node *p;
- filemap = grecs_malloc(sizeof(*filemap));
+ filemap = grecs_zalloc(sizeof(*filemap));
for (i = 0; filemap_kw[i].ident; i++)
filemap_kw[i].varptr = filemap;
if (grecs_tree_process(node->down, filemap_kw)) {
diff --git a/lib/forlangrm.y b/lib/forlangrm.y
index ecfbf25..2db1274 100644
--- a/lib/forlangrm.y
+++ b/lib/forlangrm.y
@@ -1,6 +1,6 @@
%{
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
#include "libeclat.h"
#include <grecs.h>
-#include <grecs-locus.h>
+#include <grecs/locus.h>
#include "forlangrm.h"
#include "forlan.h"
#include <string.h>
diff --git a/lib/forlanlex.l b/lib/forlanlex.l
index db893df..62265cb 100644
--- a/lib/forlanlex.l
+++ b/lib/forlanlex.l
@@ -1,6 +1,6 @@
%{
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
#include <sysexits.h>
#include <ctype.h>
#include <grecs.h>
-#include <grecs-locus.h>
+#include <grecs/locus.h>
#include "forlangrm.h"
#include "forlan.h"
@@ -100,15 +100,18 @@ continue return CONTINUE;
\"[^\\"\n]*\\\n { BEGIN(STR);
grecs_line_begin();
grecs_line_acc_grow_unescape_last(yytext + 1,
- yyleng - 1);
+ yyleng - 1,
+ &yylloc);
grecs_locus_point_advance_line(grecs_current_locus_point); }
\"[^\\"\n]*\\. { BEGIN(STR);
grecs_line_begin();
grecs_line_acc_grow_unescape_last(yytext + 1,
- yyleng - 1); }
-<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng);
+ yyleng - 1,
+ &yylloc); }
+<STR>\"[^\\"\n]*\\\n { grecs_line_acc_grow_unescape_last(yytext, yyleng,
+ &yylloc);
grecs_locus_point_advance_line(grecs_current_locus_point); }
-<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng); }
+<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng, &yylloc); }
<STR>[^\\"\n]*\" { BEGIN(INITIAL);
if (yyleng > 1)
grecs_line_add(yytext, yyleng - 1);
diff --git a/lib/gdbmmap.c b/lib/gdbmmap.c
index dde6b02..a2887df 100644
--- a/lib/gdbmmap.c
+++ b/lib/gdbmmap.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ gdbm_map_config(int dbg, struct grecs_node *node, void *data)
struct grecs_node *p;
int i;
- gdbm_map = grecs_malloc(sizeof(*gdbm_map));
+ gdbm_map = grecs_zalloc(sizeof(*gdbm_map));
for (i = 0; gdbm_map_kw[i].ident; i++)
gdbm_map_kw[i].varptr = gdbm_map;
if (grecs_tree_process(node->down, gdbm_map_kw)) {
diff --git a/lib/json.h b/lib/json.h
deleted file mode 100644
index 36ca243..0000000
--- a/lib/json.h
+++ b/dev/null
@@ -1,66 +0,0 @@
-/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
-
- Eclat is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Eclat is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <grecs.h>
-
-enum json_object_type
-{
- json_null,
- json_bool,
- json_number,
- json_string,
- json_arr,
- json_obj
-};
-
-struct json_object;
-struct json_array {
- size_t oc;
- struct json_object **ov;
-};
-
-struct json_object {
- enum json_object_type type;
- union {
- int b; /* json_bool */
- double n; /* json_number */
- char *s; /* json_string */
- struct json_array *a; /* json_arr */
- struct grecs_symtab *o; /* json_o */
- } v;
-};
-
-struct json_pair {
- char *k;
- struct json_object *v;
-};
-
-extern char const *json_err_diag;
-extern char const *json_err_ptr;
-extern struct json_object *json_return_obj;
-
-void jsonlex_setup(char const *s, size_t l);
-void jsonlex_diag(const char *s, size_t off);
-struct json_object *json_object_create(int type);
-struct grecs_symtab *json_assoc_create(void);
-void json_object_free(struct json_object *obj);
-
-struct json_object *json_parse_string(char const *input, size_t len);
-
-struct json_object *json_object_lookup(struct json_object *obj,
- const char *ident);
-
-
diff --git a/lib/jsongrm.y b/lib/jsongrm.y
deleted file mode 100644
index 398d2e7..0000000
--- a/lib/jsongrm.y
+++ b/dev/null
@@ -1,316 +0,0 @@
-%{
-/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
-
- Eclat is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Eclat is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "libeclat.h"
-#include <string.h>
-#include "jsongrm.h"
-#include "json.h"
-
-struct json_object *json_return_obj;
-
-static int yyerror(char const *s);
-
-static struct json_pair *
-pairdup(struct json_pair *in)
-{
- struct json_pair *out = grecs_malloc(sizeof(*out));
- out->k = in->k;
- out->v = in->v;
- return out;
-}
-
-static void
-pairfree(void *ptr)
-{
- struct json_pair *p = ptr;
- free(p->k);
- json_object_free(p->v);
- free(p);
-}
-
-static void
-objfree(void *ptr)
-{
- struct json_object *o = ptr;
- json_object_free(o);
-}
-
-%}
-%token <n> T_NUMBER
-%token <s> T_STRING
-%token <b> T_BOOL
-%token T_NULL T_ERR
-
-%type <a> array
-%type <list> objects objlist pairs pairlist
-%type <p> pair
-%type <obj> object
-%type <o> assoc
-
-%union {
- int b;
- double n;
- char *s;
- struct json_array *a;
- struct grecs_symtab *o;
- struct json_object *obj;
- struct grecs_list *list;
- struct json_pair *p;
-}
-%%
-
-input : object
- {
- json_return_obj = $1;
- }
- ;
-
-object : T_NUMBER
- {
- $$ = json_object_create(json_number);
- $$->v.n = $1;
- }
- | T_STRING
- {
- $$ = json_object_create(json_string);
- $$->v.s = $1;
- }
- | T_BOOL
- {
- $$ = json_object_create(json_bool);
- $$->v.b = $1;
- }
- | T_NULL
- {
- $$ = json_object_create(json_null);
- }
- | array
- {
- $$ = json_object_create(json_arr);
- $$->v.a = $1;
- }
- | assoc
- {
- $$ = json_object_create(json_obj);
- $$->v.o = $1;
- }
- ;
-
-array : '[' objects ']'
- {
- struct json_array *a = grecs_malloc(sizeof(*a));
- if (!$2) {
- a->oc = 0;
- a->ov = NULL;
- } else {
- size_t i;
- struct grecs_list_entry *ep;
- a->oc = $2->count;
- a->ov = grecs_calloc(a->oc, sizeof(a->ov));
- for (i = 0, ep = $2->head; ep; i++, ep = ep->next) {
- struct json_object *p = ep->data;
- a->ov[i] = p;
- }
- }
- $$ = a;
- }
- ;
-
-objects : /* empty */
- {
- $$ = NULL;
- }
- | objlist
- ;
-
-objlist : object
- {
- $$ = grecs_list_create();
- $$->free_entry = objfree;
- grecs_list_append($$, $1);
- }
- | objlist ',' object
- {
- grecs_list_append($1, $3);
- }
- ;
-
-assoc : '{' pairs '}'
- {
- struct grecs_symtab *s;
-
- s = json_assoc_create();
- if ($2) {
- struct grecs_list_entry *ep;
- for (ep = $2->head; ep; ep = ep->next) {
- struct json_pair *p = ep->data;
- int install = 1;
- grecs_symtab_lookup_or_install(s, p, &install);
- if (install) {
- p->k = NULL;
- p->v = NULL;
- }
- }
- grecs_list_free($2);
- }
- $$ = s;
- }
- ;
-
-pairs : /* empty */
- {
- $$ = NULL;
- }
- | pairlist
- ;
-
-pairlist: pair
- {
- $$ = grecs_list_create();
- $$->free_entry = pairfree;
- grecs_list_append($$, $1);
- }
- | pairlist ',' pair
- {
- grecs_list_append($1, $3);
- }
- ;
-
-pair : T_STRING ':' object
- {
- struct json_pair *p = grecs_malloc(sizeof(*p));
- p->k = $1;
- p->v = $3;
- $$ = p;
- }
- ;
-%%
-
-static int
-yyerror(char const *s)
-{
- jsonlex_diag(s, 0);
- return 0;
-}
-
-struct json_object *
-json_object_create(int type)
-{
- struct json_object *obj = grecs_zalloc(sizeof(*obj));
- obj->type = type;
- return obj;
-}
-
-void
-json_object_free(struct json_object *obj)
-{
- size_t i;
-
- if (!obj)
- return;
-
- switch (obj->type) {
- case json_bool:
- case json_number:
- break;
- case json_string:
- free(obj->v.s);
- break;
- case json_arr:
- for (i = 0; i < obj->v.a->oc; i++)
- json_object_free(obj->v.a->ov[i]);
- free(obj->v.a);
- break;
- case json_obj:
- grecs_symtab_free(obj->v.o);
- }
- free(obj);
-}
-
-static unsigned
-json_st_hash(void *data, unsigned long n_buckets)
-{
- struct json_pair *p = data;
- return grecs_hash_string(p->k, n_buckets);
-}
-
-static int
-json_st_cmp(const void *a, const void *b)
-{
- struct json_pair const *pa = a;
- struct json_pair const *pb = b;
- return strcmp(pa->k, pb->k);
-}
-
-static int
-json_st_copy(void *a, void *b)
-{
- struct json_pair *pa = a;
- struct json_pair *pb = b;
- memcpy(pa, pb, sizeof(*pa));
- return 0;
-}
-
-static void
-json_st_free(void *ptr)
-{
- struct json_pair *p = ptr;
-// printf("FREE %s\n", p->k);
- free(p->k);
- json_object_free(p->v);
- free(p);
-}
-
-struct grecs_symtab *
-json_assoc_create()
-{
- return grecs_symtab_create(sizeof(struct json_pair),
- json_st_hash,
- json_st_cmp,
- json_st_copy,
- NULL,
- json_st_free);
-}
-
-struct json_object *
-json_parse_string(char const *input, size_t len)
-{
- jsonlex_setup(input, len);
- if (yyparse()) {
- /* FIXME: error recovery */
- return NULL;
- }
- return json_return_obj;
-}
-
-struct json_object *
-json_object_lookup(struct json_object *obj, const char *ident)
-{
- struct json_pair key, *p;
- if (!obj || obj->type != json_obj)
- return NULL;
- key.k = ident;
- p = grecs_symtab_lookup_or_install(obj->v.o, &key, NULL);
- if (!p)
- return NULL;
- return p->v;
-}
-
-
-
-
-
diff --git a/lib/jsonlex.l b/lib/jsonlex.l
deleted file mode 100644
index 322b05d..0000000
--- a/lib/jsonlex.l
+++ b/dev/null
@@ -1,183 +0,0 @@
-%{
-/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
-
- Eclat is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- Eclat is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "libeclat.h"
-#include "jsongrm.h"
-#include "json.h"
-
-static char const *input_ptr;
-static size_t input_size;
-
-char const *json_err_diag;
-char const *json_err_ptr;
-
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- do { \
- size_t n = (max_size > input_size) ? input_size : max_size; \
- if (n) { \
- memcpy(buf, input_ptr, n); \
- input_ptr += n; \
- input_size -= n; \
- } \
- result = n; \
- } while(0)
-
-void
-jsonlex_setup(char const *s, size_t l)
-{
- input_ptr = s;
- input_size = l;
- json_err_diag = NULL;
- json_err_ptr = NULL;
- yy_flex_debug = 0;
-}
-
-void
-jsonlex_diag(const char *s, size_t off)
-{
- if (!json_err_diag) {
- json_err_diag = s;
- json_err_ptr = input_ptr - off;
- }
-}
-
-static int
-utf8_wctomb(char *u)
-{
- unsigned int wc = strtoul(u, NULL, 16);
- int count;
- char r[6];
-
- if (wc < 0x80)
- count = 1;
- else if (wc < 0x800)
- count = 2;
- else if (wc < 0x10000)
- count = 3;
- else if (wc < 0x200000)
- count = 4;
- else if (wc < 0x4000000)
- count = 5;
- else if (wc <= 0x7fffffff)
- count = 6;
- else
- return -1;
-
- switch (count) {
- /* Note: code falls through cases! */
- case 6:
- r[5] = 0x80 | (wc & 0x3f);
- wc = wc >> 6;
- wc |= 0x4000000;
- case 5:
- r[4] = 0x80 | (wc & 0x3f);
- wc = wc >> 6;
- wc |= 0x200000;
- case 4:
- r[3] = 0x80 | (wc & 0x3f);
- wc = wc >> 6;
- wc |= 0x10000;
- case 3:
- r[2] = 0x80 | (wc & 0x3f);
- wc = wc >> 6;
- wc |= 0x800;
- case 2:
- r[1] = 0x80 | (wc & 0x3f);
- wc = wc >> 6;
- wc |= 0xc0;
- case 1:
- r[0] = wc;
- }
- grecs_line_acc_grow(r, count);
- return count;
-}
-
-static int
-unescape(int c, int *o)
-{
- static char transtab[] = "\\\\\"\"//b\bf\fn\nr\rt\t";
- char *p;
-
- for (p = transtab; *p; p += 2) {
- if (*p == c) {
- *o = p[1];
- return 0;
- }
- }
- return -1;
-}
-
-#define YY_SKIP_YYWRAP 1
-static int
-yywrap()
-{
- return 1;
-}
-%}
-D [0-9]
-X [0-9a-fA-F]
-%x STR
-%%
-"-"?{D}{D}*(.{D}{D}*)?([eE][-+]?{D}{D}*)? {
- yylval.n = strtod(yytext, NULL);
- return T_NUMBER;
- }
-\"[^\\\"]*\" { grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 2);
- yylval.s = grecs_line_finish();
- return T_STRING; }
-\"[^\\\"]*\\{X}{4} { BEGIN(STR);
- grecs_line_begin();
- grecs_line_add(yytext + 1, yyleng - 5);
- utf8_wctomb(yytext + yyleng - 4);
- }
-\"[^\\\"]*\\. { int c;
- BEGIN(STR);
- grecs_line_begin();
- grecs_line_acc_grow(yytext + 1, yyleng - 2);
- if (unescape(yytext[yyleng - 1], &c)) {
- jsonlex_diag("invalid UTF-8 codepoint", 5);
- return T_ERR;
- }
- grecs_line_acc_grow_char(c);
- }
-<STR>[^\\\"]*\" { BEGIN(INITIAL);
- if (yyleng > 1)
- grecs_line_acc_grow(yytext, yyleng - 1);
- yylval.s = grecs_line_finish();
- return T_STRING; }
-<STR>[^\\\"]*\\{X}{4} {
- grecs_line_add(yytext, yyleng - 5);
- utf8_wctomb(yytext + yyleng - 4);
-}
-<STR>[^\\\"]*\\. {
- int c;
- grecs_line_acc_grow(yytext, yyleng - 2);
- if (unescape(yytext[yyleng - 1], &c)) {
- jsonlex_diag("invalid UTF-8 codepoint", 5);
- return T_ERR;
- }
- grecs_line_acc_grow_char(c); }
-
-null { return T_NULL; }
-true { yylval.b = 1; return T_BOOL; }
-false { yylval.b = 0; return T_BOOL; }
-"{"|"}"|"["|"]"|":"|"," return yytext[0];
-[ \t\n]* ;
-. { jsonlex_diag("bogus character", 0);
- return T_ERR; }
diff --git a/lib/map.c b/lib/map.c
index bbede97..c16ecd0 100644
--- a/lib/map.c
+++ b/lib/map.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -323,7 +323,7 @@ eclat_map_foreach(int (*fun)(struct eclat_map *, void *), void *data)
cl.fun = fun;
cl.data = data;
- grecs_symtab_enumerate(openmap_symtab, map_foreach, &cl);
+ grecs_symtab_foreach(openmap_symtab, map_foreach, &cl);
}
void
@@ -348,7 +348,7 @@ drv_help(void *data, void *unused)
void
eclat_map_confhelp()
{
- grecs_symtab_enumerate(mapdrv_symtab, drv_help, NULL);
+ grecs_symtab_foreach(mapdrv_symtab, drv_help, NULL);
}
int
diff --git a/lib/req2url.c b/lib/req2url.c
index b9d7512..c97d321 100644
--- a/lib/req2url.c
+++ b/lib/req2url.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ eclat_request_to_url(struct ec2_request *req)
/* Add parameters */
pc.acc = acc;
pc.delim = '?';
- grecs_symtab_enumerate(req->params, add_param, &pc);
+ grecs_symtab_foreach(req->params, add_param, &pc);
grecs_txtacc_grow_char(acc, 0);
url = grecs_txtacc_finish(acc, 1);
@@ -80,7 +80,7 @@ eclat_request_finalize(struct ec2_request *req)
eclat_request_encode(req);
pc.acc = grecs_txtacc_create();
pc.delim = 0;
- grecs_symtab_enumerate(req->params, add_param, &pc);
+ grecs_symtab_foreach(req->params, add_param, &pc);
grecs_txtacc_grow_char(pc.acc, 0);
req->postdata = grecs_txtacc_finish(pc.acc, 1);
grecs_txtacc_free(pc.acc);
diff --git a/lib/reqcreat.c b/lib/reqcreat.c
index 753a415..8bfca56 100644
--- a/lib/reqcreat.c
+++ b/lib/reqcreat.c
@@ -79,7 +79,7 @@ eclat_request_dup(struct ec2_request const *src)
NULL,
ec2_param_free);
- grecs_symtab_enumerate(src->params, ec2_param_dup, dst);
+ grecs_symtab_foreach(src->params, ec2_param_dup, dst);
if (src->headers == NULL) {
dst->headers = NULL;
} else {
diff --git a/lib/reqencode.c b/lib/reqencode.c
index 70ac16d..c5a9655 100644
--- a/lib/reqencode.c
+++ b/lib/reqencode.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,6 @@ encode_param(void *sym, void *data)
void
eclat_request_encode(struct ec2_request *req)
{
- grecs_symtab_enumerate(req->params, encode_param, NULL);
+ grecs_symtab_foreach(req->params, encode_param, NULL);
}
diff --git a/lib/reqsign.c b/lib/reqsign.c
index 05988ed..fee5adb 100644
--- a/lib/reqsign.c
+++ b/lib/reqsign.c
@@ -74,11 +74,11 @@ requestsign2(struct ec2_request *req, char *secret)
eclat_request_encode(req);
/* Collect and sort parameter names */
- n = grecs_symtab_count_entries(req->params);
+ n = grecs_symtab_count(req->params);
pnames = grecs_calloc(n, sizeof(pnames[0]));
pn.i = 0;
pn.a = pnames;
- grecs_symtab_enumerate(req->params, get_param_name, &pn);
+ grecs_symtab_foreach(req->params, get_param_name, &pn);
qsort(pnames, n, sizeof(pnames[0]), compnames);
verb = (req->flags & EC2_RF_POST) ? "POST" : "GET";
@@ -203,11 +203,11 @@ requestsign4(struct ec2_request *req, char *secret)
eclat_request_encode(req);
/* Collect and sort parameter names */
- n = grecs_symtab_count_entries(req->params);
+ n = grecs_symtab_count(req->params);
pnames = grecs_calloc(n, sizeof(pnames[0]));
pn.i = 0;
pn.a = pnames;
- grecs_symtab_enumerate(req->params, get_param_name, &pn);
+ grecs_symtab_foreach(req->params, get_param_name, &pn);
qsort(pnames, n, sizeof(pnames[0]), compnames);
/* Create a canonical request */
diff --git a/lib/seqmap.c b/lib/seqmap.c
index ae00bc6..c50d848 100644
--- a/lib/seqmap.c
+++ b/lib/seqmap.c
@@ -1,5 +1,5 @@
/* This file is part of Eclat.
- Copyright (C) 2012-2015 Sergey Poznyakoff.
+ Copyright (C) 2012-2018 Sergey Poznyakoff.
Eclat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -71,7 +71,7 @@ seqmap_config(int dbg, struct grecs_node *node, void *data)
struct seqmap *seqmap, **return_seqmap = data;
int i;
- seqmap = grecs_malloc(sizeof(*seqmap));
+ seqmap = grecs_zalloc(sizeof(*seqmap));
for (i = 0; seqmap_kw[i].ident; i++)
seqmap_kw[i].varptr = seqmap;
if (grecs_tree_process(node->down, seqmap_kw)) {

Return to:

Send suggestions and report system problems to the System administrator.