diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-07-10 19:24:03 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-07-10 19:24:03 +0300 |
commit | 83582b43ae232809fe7a718b3439218d625afb66 (patch) | |
tree | 3e6eb370c7e7dc4d691bc5776d4d05061ced32c5 | |
parent | db70332594c75b60baf7e257c68129b43f33e4c1 (diff) | |
download | slb-83582b43ae232809fe7a718b3439218d625afb66.tar.gz slb-83582b43ae232809fe7a718b3439218d625afb66.tar.bz2 |
Switch to grecs b06fb7d3
-rwxr-xr-x | bootstrap | 3 | ||||
m--------- | grecs | 0 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/config.c | 10 | ||||
-rw-r--r-- | src/expr.y | 6 | ||||
-rw-r--r-- | src/exprtab.c | 6 | ||||
-rw-r--r-- | src/logger.c | 4 | ||||
-rw-r--r-- | src/oidtab.c | 4 | ||||
-rw-r--r-- | src/output.c | 8 | ||||
-rw-r--r-- | src/slb.c | 4 | ||||
-rw-r--r-- | src/snmploop.c | 29 | ||||
-rw-r--r-- | src/symimp.c | 8 |
12 files changed, 40 insertions, 46 deletions
@@ -1,5 +1,4 @@ #! /bin/sh set -e -git submodule init -git submodule update +git submodule update --init --recursive autoreconf -f -i -s diff --git a/grecs b/grecs -Subproject 1d38d5397e97063f07e7ff84649debfdd5032ee +Subproject b06fb7d30415eec1d2efb39286ab96070c724fd diff --git a/src/Makefile.am b/src/Makefile.am index 0c38f64..84e71ad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ # This file is part of SLB -# Copyright (C) 2011 Sergey Poznyakoff +# Copyright (C) 2011, 2019 Sergey Poznyakoff # # SLB is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,11 +46,11 @@ NET_SNMP_EXLIBS = `$(NET_SNMP_CONFIG) --external-libs` AM_LDFLAGS = $(NET_SNMP_LIBS) $(NET_SNMP_EXLIBS) LDADD=@LIBOBJS@ ../grecs/src/libgrecs.a -lm -INCLUDES = -I$(top_srcdir)/grecs/src/ $(NET_SNMP_INCLUDES) incdir=$(pkgdatadir)/$(VERSION)/include AM_CPPFLAGS= \ + @GRECS_INCLUDES@ $(NET_SNMP_INCLUDES) \ -DSYSCONFDIR=\"$(sysconfdir)\"\ -DDEFAULT_VERSION_INCLUDE_DIR=\"$(incdir)\"\ -DDEFAULT_INCLUDE_DIR=\"$(pkgdatadir)/include\"\ diff --git a/src/config.c b/src/config.c index 877bd85..e62a13d 100644 --- a/src/config.c +++ b/src/config.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011, 2012 Sergey Poznyakoff + Copyright (C) 2011, 2012, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1033,7 +1033,7 @@ static struct grecs_keyword slb_kw[] = { { "foreground", NULL, N_("Start in foreground even in daemon mode"), grecs_type_bool, GRECS_DFLT, &foreground }, { "pidfile", N_("file"), N_("Set pid file name"), - grecs_type_string, GRECS_DFLT, &pidfile }, + grecs_type_string, GRECS_DFLT|GRECS_CONST, &pidfile }, #if 0 /* These are reserved for future use. The '' quotes are used to pacify make check-docs in /dir */ @@ -1077,10 +1077,10 @@ static struct grecs_keyword slb_kw[] = { grecs_type_size, GRECS_DFLT, &output_head_count }, { "output-file", NULL, N_("Name of the output file or command"), - grecs_type_string, GRECS_DFLT, &output_file }, + grecs_type_string, GRECS_DFLT|GRECS_CONST, &output_file }, { "output-format", NULL, N_("format string for output records"), - grecs_type_string, GRECS_DFLT, &output_format }, + grecs_type_string, GRECS_DFLT|GRECS_CONST, &output_format }, { "begin-output-message", NULL, N_("string emitted before formatting output records"), grecs_type_string, GRECS_DFLT, &begin_output_message }, @@ -1118,7 +1118,7 @@ config_init() DEFAULT_INCLUDE_DIR, NULL); grecs_preprocessor = DEFAULT_PREPROCESSOR; grecs_log_to_stderr = 1; - grecs_adjust_string_locations = 1; + grecs_parser_options = GRECS_OPTION_ADJUST_STRING_LOCATIONS; grecs_print_diag_fun = grecs_print_diag; } @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ %{ #include "slb.h" -#include "grecs-locus.h" +#include "grecs/locus.h" #include <math.h> double round(double x); @@ -1151,7 +1151,7 @@ eval_expression(struct slb_expression *expr, struct slb_node_state **pstate, if (debug_level[SLB_DEBCAT_EVAL] >= 2) { debug_printf("evaluating expression \"%s\"", expr->ex_text); debug_printf("input arguments:"); - grecs_symtab_enumerate(expr->ex_vartab, _print_arg, NULL); + grecs_symtab_foreach(expr->ex_vartab, _print_arg, NULL); } if (evalnode(expr->ex_tree, pstate, &res)) { diff --git a/src/exprtab.c b/src/exprtab.c index 1d6422e..98a914b 100644 --- a/src/exprtab.c +++ b/src/exprtab.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -318,8 +318,8 @@ fixup_expression(struct slb_expression *expr, struct grecs_symtab *vit) nodefixup(expr->ex_tree, vit, expr); clos.rc = grecs_error_count; clos.loc = &expr->ex_locus; - grecs_symtab_enumerate(expr->ex_vartab, report_undefined_refs, &clos); + grecs_symtab_foreach(expr->ex_vartab, report_undefined_refs, &clos); undo_output_refs(); - grecs_symtab_enumerate(vit, mark_used_instances, &expr->ex_locus); + grecs_symtab_foreach(vit, mark_used_instances, &expr->ex_locus); return clos.rc; } diff --git a/src/logger.c b/src/logger.c index cc2daea..a54e0b8 100644 --- a/src/logger.c +++ b/src/logger.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ along with SLB. If not, see <http://www.gnu.org/licenses/>. */ #include "slb.h" -#include "grecs-locus.h" +#include "grecs/locus.h" int log_to_stderr = -1; /* -1 means autodetect */ int syslog_facility = LOG_DAEMON; diff --git a/src/oidtab.c b/src/oidtab.c index 09a0cde..a11d2b5 100644 --- a/src/oidtab.c +++ b/src/oidtab.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -103,7 +103,7 @@ create_oidtab(struct grecs_symtab *vit) if (!oidtab) grecs_alloc_die(); - grecs_symtab_enumerate(vit, _create_ref, oidtab); + grecs_symtab_foreach(vit, _create_ref, oidtab); return oidtab; } diff --git a/src/output.c b/src/output.c index 755e1a3..3fa99d5 100644 --- a/src/output.c +++ b/src/output.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -215,7 +215,7 @@ ref_drv(struct slb_server *srv, void *data, "expression %.*s", (int)(slen - 1), s + 1); exit(EX_CONFIG); } - grecs_symtab_enumerate(expr->ex_vartab, _ref_var, NULL); + grecs_symtab_foreach(expr->ex_vartab, _ref_var, NULL); if (expr->ex_min_eval > output_suppress_count) output_suppress_count = expr->ex_min_eval; symtab_register_expression(&srv->exprtab, expr); @@ -257,7 +257,7 @@ _unref(void *sym, void *data) void undo_output_refs() { - grecs_symtab_enumerate(outreftab, _unref, NULL); + grecs_symtab_foreach(outreftab, _unref, NULL); } static int @@ -276,7 +276,7 @@ _report_unbound_refs(void *sym, void *data) void report_unbound_output_refs(struct slb_server *srv) { - grecs_symtab_enumerate(outreftab, _report_unbound_refs, srv); + grecs_symtab_foreach(outreftab, _report_unbound_refs, srv); } @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011 Sergey Poznyakoff + Copyright (C) 2011, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -387,7 +387,7 @@ test_eval(int argc, char **argv) printf(eval_output_format, result); } while (slb_loop_serial++, slb_loop_ts += wakeup_interval, next_loop = 0, - (rc = grecs_symtab_enumerate(syminst, _next_val, + (rc = grecs_symtab_foreach(syminst, _next_val, &next_loop)) == 0 && next_loop); return rc; } diff --git a/src/snmploop.c b/src/snmploop.c index 7c5f215..b2f3827 100644 --- a/src/snmploop.c +++ b/src/snmploop.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011, 2012 Sergey Poznyakoff + Copyright (C) 2011, 2012, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,11 +91,9 @@ slb_server_init(struct slb_server *srv, int clrflag) { slb_node_state_init(srv->state); srv->expr->ex_eval_count = 0; - grecs_symtab_enumerate(srv->assertions, - assrt_clear_prev, - NULL); + grecs_symtab_foreach(srv->assertions, assrt_clear_prev, NULL); if (clrflag) { - grecs_symtab_enumerate(srv->tables, table_clear, NULL); + grecs_symtab_foreach(srv->tables, table_clear, NULL); srv->flags &= ~clrflag; } } @@ -324,7 +322,8 @@ slb_table_grow(struct slb_table *tab, struct variable_list *vp) char *buf; struct slb_idxnum *ent; int install = 1; - int ovf, out_len; + int ovf; + size_t out_len; buf = slb_format_oid_value(vp->name, vp->name_length, vp, NULL); if (!buf) { @@ -384,7 +383,7 @@ oid_to_table(struct slb_server *srv, oid *oid, size_t oidlen) clos.oid = oid; clos.oidlen = oidlen; clos.result = NULL; - grecs_symtab_enumerate(srv->tables, table_match_var, &clos); + grecs_symtab_foreach(srv->tables, table_match_var, &clos); return clos.result; } @@ -525,11 +524,11 @@ process_next(struct slb_server *srv, struct snmp_pdu *pdu) snmp_free_pdu(pdu2); debug(SLB_DEBCAT_SNMP, 2, ("%s: resolving indexed variables", srvid(srv))); - grecs_symtab_enumerate(srv->varinst, + grecs_symtab_foreach(srv->varinst, resolve_varinst_index, srv); #if 0 - grecs_symtab_enumerate(srv->assertions, + grecs_symtab_foreach(srv->assertions, resolve_assertion_index, srv); #endif @@ -712,20 +711,16 @@ send_requests() refcnt++; req = snmp_pdu_create(SNMP_MSG_GETNEXT); - grecs_symtab_enumerate(srv->tables, add_table_var, - req); + grecs_symtab_foreach(srv->tables, add_table_var, req); srv->flags |= SLB_SRV_TAB_RESOLVED; } else { srv->sess->callback = asynch_response; varinst_unset(srv->varinst); req = snmp_pdu_create(SNMP_MSG_GET); - grecs_symtab_enumerate(srv->varinst, - add_snmp_var, - req); - grecs_symtab_enumerate(srv->assertions, - add_snmp_assertion, - req); + grecs_symtab_foreach(srv->varinst, add_snmp_var, req); + grecs_symtab_foreach(srv->assertions, + add_snmp_assertion, req); } if (snmp_send(srv->sess, req)) { diff --git a/src/symimp.c b/src/symimp.c index d8d693c..a53e2bc 100644 --- a/src/symimp.c +++ b/src/symimp.c @@ -1,5 +1,5 @@ /* This file is part of SLB - Copyright (C) 2011, 2012 Sergey Poznyakoff + Copyright (C) 2011, 2012, 2019 Sergey Poznyakoff SLB is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,7 +91,7 @@ _varinst_unset(void *sym, void *data) void varinst_unset(struct grecs_symtab *vit) { - grecs_symtab_enumerate(vit, _varinst_unset, NULL); + grecs_symtab_foreach(vit, _varinst_unset, NULL); } static int @@ -109,7 +109,7 @@ _varinst_clear(void *sym, void *data) void varinst_clear(struct grecs_symtab *vit) { - grecs_symtab_enumerate(vit, _varinst_clear, NULL); + grecs_symtab_foreach(vit, _varinst_clear, NULL); } static int @@ -128,7 +128,7 @@ int varinst_allset(struct grecs_symtab *vit) { int rc = 1; - grecs_symtab_enumerate(vit, _varinst_allset, &rc); + grecs_symtab_foreach(vit, _varinst_allset, &rc); return rc; } |