From: oetiker Date: Sat, 13 Jul 2002 18:35:37 +0000 (+0000) Subject: fixed DEF_NAM_FMT definition X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b9b92c21c1b517ca2d69e7baac4be7587aff5eb5;p=rrdtool.git fixed DEF_NAM_FMT definition added double include protection the rrd_graph.h and rrd_rpncalc.h git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@159 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_graph.h b/src/rrd_graph.h index fa5e7ce..0f9079a 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -1,3 +1,6 @@ +#ifndef _RRD_GRAPH_H +#define _RRD_GRAPH_H + #include "rrd_tool.h" #include "rrd_rpncalc.h" #include "rrd_gfx.h" @@ -218,3 +221,5 @@ int vdef_parse(struct graph_desc_t *,char *); int vdef_calc(image_desc_t *, int); int vdef_percent_compar(const void *,const void *); int graph_size_location(image_desc_t *, int, int); + +#endif diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c index 41d1ce3..8e64d8b 100644 --- a/src/rrd_rpncalc.c +++ b/src/rrd_rpncalc.c @@ -6,6 +6,7 @@ #include "rrd_tool.h" #include "rrd_rpncalc.h" +#include "rrd_graph.h" #include short addop2str(enum op_en op, enum op_en op_type, char *op_str, @@ -323,7 +324,7 @@ rpn_parse(void *key_hash,char *expr,long (*lookup)(void *,char*)){ #undef match_op - else if ((sscanf(expr,"%29[_A-Za-z0-9]%n", + else if ((sscanf(expr, DEF_NAM_FMT "%n", vname,&pos) == 1) && ((rpnp[steps].ptr = (*lookup)(key_hash,vname)) != -1)){ rpnp[steps].op = OP_VARIABLE; diff --git a/src/rrd_rpncalc.h b/src/rrd_rpncalc.h index ecf11c8..a4e7c65 100644 --- a/src/rrd_rpncalc.h +++ b/src/rrd_rpncalc.h @@ -3,6 +3,8 @@ **************************************************************************** * rrd_rpncalc.h RPN calculator functions ****************************************************************************/ +#ifndef _RRD_RPNCALC_H +#define _RRD_RPNCALC_H /* WARNING: if new operators are added, they MUST be added after OP_END. * This is because COMPUTE (CDEF) DS store OP nodes by number (name is not @@ -50,3 +52,5 @@ rpnp_t * rpn_expand(rpn_cdefds_t *rpnc); void rpn_compact2str(rpn_cdefds_t *rpnc,ds_def_t *ds_def,char **str); rpnp_t * rpn_parse(void *key_hash,char *expr, long (*lookup)(void *,char *)); short rpn_calc(rpnp_t *rpnp, rpnstack_t *rpnstack, long data_idx, rrd_value_t *output, int output_idx); + +#endif