/* GRAS_LOG_MAYDAY: define this to replace the logging facilities with basic
printf function. Useful to debug the logging facilities themselves */
#undef GRAS_LOG_MAYDAY
-//#define GRAS_LOG_MAYDAY
+/*#define GRAS_LOG_MAYDAY*/
#ifndef _GRAS_LOG_H_
&_GRAS_LOGV(parent), 0, 0, \
#catName, gras_log_priority_uninitialized, 1, \
0, 1 \
- };
+ }
/**
* GRAS_LOG_NEW_CATEGORY:
* (used by macros that don't explicitly specify a category).
*/
#define GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
- GRAS_LOG_NEW_SUBCATEGORY(cname, parent, desc) \
+ GRAS_LOG_NEW_SUBCATEGORY(cname, parent, desc); \
GRAS_LOG_DEFAULT_CATEGORY(cname)
/**
#define GRAS_LOG_EXTERNAL_CATEGORY(cname) \
extern gras_log_category_t _GRAS_LOGV(cname)
-// Functions you may call
+/* Functions you may call */
extern gras_error_t gras_log_control_set(const char* cs);
-// Forward declarations
+/* Forward declarations */
typedef struct gras_log_appender_s gras_log_appender_t;
typedef struct gras_log_event_s gras_log_event_t;
typedef struct gras_log_category_s gras_log_category_t;
int isThreshInherited;
/*@null@*/ gras_log_appender_t *appender;
int willLogToParent;
- // TODO: Formats?
+ /* TODO: Formats? */
};
struct gras_log_appender_s {
extern void gras_log_appender_set(gras_log_category_t* cat,
gras_log_appender_t* app);
-// Functions that you shouldn't call.
+/* Functions that you shouldn't call. */
extern void _gras_log_event_log(gras_log_event_t*ev,
const char *fmt,
- ...)
-#ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
-#endif
-;
+ ...) _GRAS_GNUC_PRINTF(2,3);
extern int _gras_log_cat_init(gras_log_priority_t priority,
gras_log_category_t* category);
#define _GRAS_LOG_PRE(catv, priority) do { \
if (_GRAS_LOG_ISENABLEDV(catv, priority)) { \
gras_log_event_t _log_ev = \
- {&(catv),priority,__FILE__,__FUNCTION__,__LINE__}; \
+ {&(catv),priority,__FILE__,_GRAS_GNUC_FUNCTION,__LINE__}; \
_gras_log_event_log(&_log_ev
#define _GRAS_LOG_POST \
#define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5)
#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
-#ifdef __GNUC__
-#define GRAS_IN LOG1(gras_log_priority_trace, ">> begin of %s", __FUNCTION__)
-#define GRAS_IN1(fmt,a) LOG2(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a)
-#define GRAS_IN2(fmt,a,b) LOG3(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b)
-#define GRAS_IN3(fmt,a,b,c) LOG4(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c)
-#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c,d)
-#define GRAS_OUT LOG1(gras_log_priority_trace, "<< end of %s", __FUNCTION__)
-#else /* if fool enough to compile without gcc */
-#define GRAS_IN LOG0(gras_log_priority_trace, ">> begin of function")
-#define GRAS_IN1(fmt,a) LOG2(gras_log_priority_trace, ">> begin of function " fmt, a)
-#define GRAS_IN2(fmt,a,b) LOG3(gras_log_priority_trace, ">> begin of function " fmt, a,b)
-#define GRAS_IN3(fmt,a,b,c) LOG4(gras_log_priority_trace, ">> begin of function " fmt, a,b,c)
-#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of function " fmt, a,b,c,d)
-
-#define GRAS_OUT(fmt,a) LOG0(gras_log_priority_trace, "<< end of function")
-#endif /* end of foolness for non-gcc */
+#define GRAS_IN LOG1(gras_log_priority_trace, ">> begin of %s", _GRAS_GNUC_FUNCTION)
+#define GRAS_IN1(fmt,a) LOG2(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a)
+#define GRAS_IN2(fmt,a,b) LOG3(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b)
+#define GRAS_IN3(fmt,a,b,c) LOG4(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c)
+#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c,d)
+#define GRAS_OUT LOG1(gras_log_priority_trace, "<< end of %s", _GRAS_GNUC_FUNCTION)
#endif /* ! _GRAS_LOG_H_ */
#define gras_new(type, count) ((type*)gras_malloc (sizeof (type) * (count)))
#define gras_new0(type, count) ((type*)gras_malloc0 (sizeof (type) * (count)))
+/* Attributes are only in recent versions of GCC */
+
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#define _GRAS_GNUC_PRINTF( format_idx, arg_idx ) \
+# define _GRAS_GNUC_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
-#define _GRAS_GNUC_SCANF( format_idx, arg_idx ) \
+# define _GRAS_GNUC_SCANF( format_idx, arg_idx ) \
__attribute__((__format__ (__scanf__, format_idx, arg_idx)))
-#define _GRAS_GNUC_FORMAT( arg_idx ) \
+# define _GRAS_GNUC_FORMAT( arg_idx ) \
__attribute__((__format_arg__ (arg_idx)))
-#define _GRAS_GNUC_NORETURN \
- __attribute__((__noreturn__))
+# define _GRAS_GNUC_NORETURN __attribute__((__noreturn__))
+
#else /* !__GNUC__ */
-#define _GRAS_GNUC_PRINTF( format_idx, arg_idx )
-#define _GRAS_GNUC_SCANF( format_idx, arg_idx )
-#define _GRAS_GNUC_FORMAT( arg_idx )
-#define _GRAS_GNUC_NORETURN
+# define _GRAS_GNUC_PRINTF( format_idx, arg_idx )
+# define _GRAS_GNUC_SCANF( format_idx, arg_idx )
+# define _GRAS_GNUC_FORMAT( arg_idx )
+# define _GRAS_GNUC_NORETURN
+
#endif /* !__GNUC__ */
+/* inline and __FUNCTION__ are only in GCC when -ansi is of */
+
+#if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
+
+# define _GRAS_GNUC_FUNCTION __FUNCTION__
+# define _GRAS_INLINE inline
+#else
+# define _GRAS_GNUC_FUNCTION "function"
+# define _GRAS_INLINE
+#endif
+
+
void gras_abort(void) _GRAS_GNUC_NORETURN;
/* FIXME: This is a very good candidate to rewrite (along with a proper string stuff)
gras_dynar_t *varstack,*frame;
gras_cbps_elm_t *p_var;
gras_error_t errcode;
- char *varname = strdup(name);
+ char *varname = (char*)strdup(name);
- DEBUG2("push(%s,%p)",name,data);
+ DEBUG2("push(%s,%p)",name,(void*)data);
errcode = gras_dict_get(ps->space, name, (void **)&varstack);
if (errcode == mismatch_error) {
gras_dynar_push(varstack, &p_var);
gras_dynar_pop(ps->frames, &frame);
- DEBUG4("Push %s (%p @%p) into frame %p",varname,varname,&varname,frame);
+ DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
gras_dynar_push(frame, &varname);
gras_dynar_push(ps->frames, &frame);
return no_error;
gras_dynar_t *varstack = NULL;
gras_cbps_elm_t *var = NULL;
- DEBUG2("Get ride of %s (%p)",name,name);
+ DEBUG2("Get ride of %s (%p)",name,(void*)name);
gras_dict_get(ps->space, name, (void **)&varstack);
gras_dynar_pop(varstack, &var);
typedef struct s_gras_dd_cat_array {
gras_datadesc_type_t *type;
- /* element_count < 0 means dynamically defined */
- long int fixed_size;
+ /* element_count == 0 means dynamically defined */
+ unsigned long int fixed_size;
/* callback used to return the dynamic length */
gras_datadesc_type_cb_int_t dynamic_size;
unsigned int name_len;
/* payload */
- long int size[gras_arch_count];
+ unsigned long int size[gras_arch_count];
- long int alignment[gras_arch_count];
- long int aligned_size[gras_arch_count];
+ unsigned long int alignment[gras_arch_count];
+ unsigned long int aligned_size[gras_arch_count];
enum e_gras_datadesc_type_category category_code;
union u_gras_datadesc_category category;
***/
const gras_arch_desc_t gras_arches[gras_arch_count] = {
- {"little32", 0, {1,2,4,4,8, 4,4, 4,8}, // 4},
+ {"little32", 0, {1,2,4,4,8, 4,4, 4,8},
{1,2,4,4,4, 4,4, 4,4}},
- {"little64", 0, {1,2,4,8,8, 8,8, 4,8}, // 8},
+ {"little64", 0, {1,2,4,8,8, 8,8, 4,8},
{1,2,4,8,8, 8,8, 4,8}},
- {"big32", 1, {1,2,4,4,8, 4,4, 4,8}, // 8},
+ {"big32", 1, {1,2,4,4,8, 4,4, 4,8},
{1,2,4,4,8, 4,4, 4,8}},
- {"big64", 1, {1,2,4,8,8, 8,8, 4,8}, // 8}
+ {"big64", 1, {1,2,4,8,8, 8,8, 4,8},
{1,2,4,8,8, 8,8, 4,8}},
- {"aix", 1, {1,2,4,4,8, 4,4, 4,8}, // 8}
+ {"aix", 1, {1,2,4,4,8, 4,4, 4,8},
{1,2,4,4,8, 4,4, 4,4}}
};
if (!res)
RAISE_MALLOC;
- res->name = strdup(name);
+ res->name = (char*)strdup(name);
res->name_len = strlen(name);
*dst=res;
return no_error;
}
- gras_assert1(field_type->size >= 0,
+ gras_assert1(field_type->size != 0,
"Cannot add a dynamically sized field in structure %s",
struct_type->name);
if (!field)
RAISE_MALLOC;
- field->name = strdup(name);
+ field->name = (char*)strdup(name);
DEBUG0("----------------");
DEBUG3("PRE s={size=%ld,align=%ld,asize=%ld}",
int arch;
GRAS_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
- gras_assert1(field_type->size >= 0,
+ gras_assert1(field_type->size != 0,
"Cannot add a dynamically sized field in union %s",
union_type->name);
if (!field)
RAISE_MALLOC;
- field->name = strdup(name);
+ field->name = (char*)strdup(name);
field->type = field_type;
/* All offset are left to 0 in an union */
TRY(gras_ddt_new(name,dst));
res=*dst;
- gras_assert1(fixed_size > 0, "'%s' is a array of negative fixed size",name);
+ gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
for (arch=0; arch<gras_arch_count; arch ++) {
res->size[arch] = fixed_size * element_type->aligned_size[arch];
res->alignment[arch] = element_type->alignment[arch];
"Redefinition of type %s does not match", name);
gras_assert1(res->category.array_data.type == element_type,
"Redefinition of type %s does not match", name);
- gras_assert1(res->category.array_data.fixed_size == -1,
+ gras_assert1(res->category.array_data.fixed_size == 0,
"Redefinition of type %s does not match", name);
gras_assert1(res->category.array_data.dynamic_size == dynamic_size,
"Redefinition of type %s does not match", name);
res=*dst;
for (arch=0; arch<gras_arch_count; arch ++) {
- res->size[arch] = -1; /* make sure it indicates "dynamic" */
+ res->size[arch] = 0; /* make sure it indicates "dynamic" */
res->alignment[arch] = element_type->alignment[arch];
- res->aligned_size[arch] = -1; /*FIXME: That was so in GS, but looks stupid*/
+ res->aligned_size[arch] = 0; /*FIXME: That was so in GS, but looks stupid*/
}
res->category_code = e_gras_datadesc_type_cat_array;
res->category.array_data.type = element_type;
- res->category.array_data.fixed_size = -1;
+ res->category.array_data.fixed_size = 0;
res->category.array_data.dynamic_size = dynamic_size;
return no_error;
} else if (type->category_code == e_gras_datadesc_type_cat_struct) {
field_array = type->category.struct_data.fields;
} else {
- ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,type);
+ ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,(void*)type);
gras_abort();
}
gras_dynar_foreach(field_array,field_num,field) {
static gras_datadesc_type_t *int_type = NULL;
static gras_datadesc_type_t *pointer_type = NULL;
-static inline gras_error_t gras_dd_send_int(gras_socket_t *sock, int i);
-static inline gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i);
+static _GRAS_INLINE gras_error_t gras_dd_send_int(gras_socket_t *sock, int i);
+static _GRAS_INLINE gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i);
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
gras_dd_alloc_ref(gras_dict_t *refs, long int size,
char **r_ref, long int r_len,
char **l_ref);
-static inline int
+static _GRAS_INLINE int
gras_dd_is_r_null(char **r_ptr, long int length);
static gras_error_t
int subsize);
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
gras_dd_send_int(gras_socket_t *sock,int i) {
if (!int_type) {
return gras_trp_chunk_send(sock, (char*)&i, int_type->size[GRAS_THISARCH]);
}
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i) {
gras_error_t errcode;
* of 'length' bytes set to 0.
* FIXME: Check in configure?
*/
-static inline int
+static _GRAS_INLINE int
gras_dd_is_r_null(char **r_ptr, long int length) {
int i;
return 1;
}
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
gras_dd_alloc_ref(gras_dict_t *refs,
long int size,
char **r_ref,
RAISE_MALLOC;
*l_ref = l_data;
- DEBUG2("l_data=%p, &l_data=%p",l_data,&l_data);
+ DEBUG2("l_data=%p, &l_data=%p",(void*)l_data,(void*)&l_data);
DEBUG3("alloc_ref: r_ref=%p; *r_ref=%p, r_len=%ld",
- r_ref, r_ref?*r_ref:NULL, r_len);
+ (void*)r_ref, (void*)(r_ref?*r_ref:NULL), r_len);
#ifdef DETECT_CYCLE
if (r_ref && !gras_dd_is_r_null( r_ref, r_len)) {
gras_error_t errcode;
if (d1->send != d2->send) {
DEBUG4("ddt_cmp: %s->send=%p != %s->send=%p",
- d1->name,d1->send, d2->name,d2->send);
- return d1->send > d2->send ? 1 : -1;
+ d1->name,(void*)d1->send, d2->name,(void*)d2->send);
+ return 1; /* ISO C forbids ordered comparisons of pointers to functions */
}
if (d1->recv != d2->recv) {
DEBUG4("ddt_cmp: %s->recv=%p != %s->recv=%p",
- d1->name,d1->recv, d2->name,d2->recv);
- return d1->recv > d2->recv ? 1 : -1;
+ d1->name,(void*)d1->recv, d2->name,(void*)d2->recv);
+ return 1; /* ISO C forbids ordered comparisons of pointers to functions */
}
switch (d1->category_code) {
case e_gras_datadesc_type_cat_union:
if (d1->category.union_data.selector != d2->category.union_data.selector)
- return d1->category.union_data.selector > d2->category.union_data.selector ? 1 : -1;
+ return 1; /* ISO C forbids ordered comparisons of pointers to functions */
if (gras_dynar_length(d1->category.union_data.fields) !=
gras_dynar_length(d2->category.union_data.fields))
case e_gras_datadesc_type_cat_ref:
if (d1->category.ref_data.selector != d2->category.ref_data.selector)
- return d1->category.ref_data.selector > d2->category.ref_data.selector ? 1 : -1;
+ return 1; /* ISO C forbids ordered comparisons of pointers to functions */
if (d1->category.ref_data.type != d2->category.ref_data.type)
return d1->category.ref_data.type > d2->category.ref_data.type ? 1 : -1;
return d1->category.array_data.fixed_size > d2->category.array_data.fixed_size ? 1 : -1;
if (d1->category.array_data.dynamic_size != d2->category.array_data.dynamic_size)
- return d1->category.array_data.dynamic_size > d2->category.array_data.dynamic_size ? 1 : -1;
+ return 1; /* ISO C forbids ordered comparisons of pointers to functions */
break;
}
errcode = gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy);
if (errcode == mismatch_error) {
- VERB1("Sending data referenced at %p", *ref);
+ VERB1("Sending data referenced at %p", (void*)*ref);
TRY(gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL));
TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref));
} else if (errcode == no_error) {
- VERB1("Not sending data referenced at %p (already done)", *ref);
+ VERB1("Not sending data referenced at %p (already done)", (void*)*ref);
} else {
return errcode;
}
/* determine and send the element count */
count = array_data.fixed_size;
- if (count <= 0) {
+ if (count == 0) {
count = array_data.dynamic_size(state,data);
gras_assert1(count >=0,
"Invalid (negative) array size for type %s",type->name);
int cpt;
gras_datadesc_type_t *sub_type;
- VERB2("Recv a %s @%p", type->name, l_data);
+ VERB2("Recv a %s @%p", type->name, (void*)l_data);
gras_assert(l_data);
switch (type->category_code) {
if (errcode == mismatch_error) {
- int subsubcount = -1;
+ int subsubcount = 0;
void *l_referenced=NULL;
VERB2("Receiving a ref to '%s', remotely @%p",
gras_datadesc_type_t *subsub_type;
subsubcount = array_data.fixed_size;
- if (subsubcount < 0)
+ if (subsubcount == 0)
TRY(gras_dd_recv_int(sock, r_arch, &subsubcount));
subsub_type = array_data.type;
array_data = type->category.array_data;
/* determine element count locally, or from caller, or from peer */
count = array_data.fixed_size;
- if (count <= 0)
+ if (count == 0)
count = subsize;
- if (count < 0)
+ if (count == 0)
TRY(gras_dd_recv_int(sock, r_arch, &count));
- if (count < 0)
+ if (count == 0)
RAISE1(mismatch_error,
- "Invalid (negative) array size for type %s",type->name);
+ "Invalid (=0) array size for type %s",type->name);
/* receive the content */
sub_type = array_data.type;
GRAS_IN;
gras_dynar_pop(dynar,&former);
TRY(gras_datadesc_ref_pop_arr(former.type,&ref.type)); /* redeclaration are ignored */
- ref.type_name = strdup(ref.type->name);
+ ref.type_name = (char*)strdup(ref.type->name);
ref.name = former.name;
gras_free(former.type_name);
strcmp(gras_ddt_parse_text,"int") ) {
/* bastard user, they omited "int" ! */
- identifier.type_name=strdup("int");
+ identifier.type_name=(char*)strdup("int");
DEBUG0("the base type is 'int', which were omited (you vicious user)");
} else {
- identifier.type_name=strdup(gras_ddt_parse_text);
+ identifier.type_name=(char*)strdup(gras_ddt_parse_text);
DEBUG1("the base type is '%s'",identifier.type_name);
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
}
/**** look for the symbols of this type ****/
for(expect_id_separator = 0;
- (//(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME
+ (/*(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME*/
(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_SEMI_COLON)) ;
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump() ) {
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
PARSE_ERROR1("Unparsable annotation: Expected key name, got '%s'",gras_ddt_parse_text);
- keyname = strdup(gras_ddt_parse_text);
+ keyname = (char*)strdup(gras_ddt_parse_text);
while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
PARSE_ERROR1("Unparsable annotation: Expected key value, got '%s'",gras_ddt_parse_text);
- keyval = strdup(gras_ddt_parse_text);
+ keyval = (char*)strdup(gras_ddt_parse_text);
while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
/* found a symbol name. Build the type and push it to dynar */
if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
- identifier.name=strdup(gras_ddt_parse_text);
+ identifier.name=(char*)strdup(gras_ddt_parse_text);
DEBUG1("Found the identifier \"%s\"",identifier.name);
TRY(gras_dynar_push(identifiers, &identifier));
PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name,field.tm.is_ref);
- VERB2("Append field '%s' to %p",field.name, struct_type);
+ VERB2("Append field '%s' to %p",field.name, (void*)struct_type);
TRYFAIL(gras_datadesc_struct_append(struct_type, field.name, field.type));
gras_free(field.name);
gras_free(field.type_name);
}
gras_dynar_reset(identifiers);
- DEBUG1("struct_type=%p",struct_type);
+ DEBUG1("struct_type=%p",(void*)struct_type);
/* Make sure that all fields declaring a size push it into the cbps */
gras_dynar_foreach(fields_to_push,i, name) {
- DEBUG1("struct_type=%p",struct_type);
- VERB2("Push field '%s' into size stack of %p", name, struct_type);
+ DEBUG1("struct_type=%p",(void*)struct_type);
+ VERB2("Push field '%s' into size stack of %p", name, (void*)struct_type);
gras_datadesc_cb_field_push(struct_type, name);
gras_free(name);
}
int gras_ddt_parse_char_pos = 0;
int gras_ddt_parse_tok_num = 0;
const char *definition;
- GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_lexer,ddt_parse,"Lexer of the parsing");
+ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
#define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
#define annotate 1
#define comment 2
YY_RULE_SETUP
#line 77 "gras/DataDesc/ddt_parse.yy.l"
{ /****************** COMMENTS ************************/
- // constructs like /*g [string] g*/ are not comments but size annotations
+ /* constructs like : */
+ /*g [string] g*/
+ /* are not comments but size annotations */
comment_caller = INITIAL;
BEGIN(comment);
}
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 83 "gras/DataDesc/ddt_parse.yy.l"
+#line 85 "gras/DataDesc/ddt_parse.yy.l"
{
comment_caller = foo;
BEGIN(comment);
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 88 "gras/DataDesc/ddt_parse.yy.l"
+#line 90 "gras/DataDesc/ddt_parse.yy.l"
{ /* eat anything that's not a '*' */
}
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 90 "gras/DataDesc/ddt_parse.yy.l"
+#line 92 "gras/DataDesc/ddt_parse.yy.l"
{ /* eat up '*'s not followed by '/'s */
}
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 92 "gras/DataDesc/ddt_parse.yy.l"
+#line 94 "gras/DataDesc/ddt_parse.yy.l"
{
++gras_ddt_parse_line_pos;
gras_ddt_parse_col_pos=0;
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 97 "gras/DataDesc/ddt_parse.yy.l"
+#line 99 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos+= strlen(yytext);
gras_ddt_parse_col_pos+= strlen(yytext);
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 103 "gras/DataDesc/ddt_parse.yy.l"
+#line 105 "gras/DataDesc/ddt_parse.yy.l"
{ /****************** STATEMENTS ************************/
gras_ddt_parse_char_pos += strlen(yytext);
gras_ddt_parse_col_pos += strlen(yytext);
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 109 "gras/DataDesc/ddt_parse.yy.l"
+#line 111 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 115 "gras/DataDesc/ddt_parse.yy.l"
+#line 117 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 121 "gras/DataDesc/ddt_parse.yy.l"
+#line 123 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 127 "gras/DataDesc/ddt_parse.yy.l"
+#line 129 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 133 "gras/DataDesc/ddt_parse.yy.l"
+#line 135 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 139 "gras/DataDesc/ddt_parse.yy.l"
+#line 141 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 145 "gras/DataDesc/ddt_parse.yy.l"
+#line 147 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 151 "gras/DataDesc/ddt_parse.yy.l"
+#line 153 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 157 "gras/DataDesc/ddt_parse.yy.l"
+#line 159 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 163 "gras/DataDesc/ddt_parse.yy.l"
+#line 165 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_line_pos++;
gras_ddt_parse_char_pos++;
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 169 "gras/DataDesc/ddt_parse.yy.l"
+#line 171 "gras/DataDesc/ddt_parse.yy.l"
{
gras_ddt_parse_char_pos++;
gras_ddt_parse_col_pos++;
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 174 "gras/DataDesc/ddt_parse.yy.l"
+#line 176 "gras/DataDesc/ddt_parse.yy.l"
ECHO;
YY_BREAK
-#line 935 "gras/DataDesc/ddt_parse.yy.c"
+#line 937 "gras/DataDesc/ddt_parse.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(annotate):
case YY_STATE_EOF(comment):
return 0;
}
#endif
-#line 174 "gras/DataDesc/ddt_parse.yy.l"
+#line 176 "gras/DataDesc/ddt_parse.yy.l"
/* {space}+ { return(TOKEN_SPACE);} */
case GRAS_DDT_PARSE_TOKEN_LA : {printf("TOKEN_LA ");break;}
case GRAS_DDT_PARSE_TOKEN_RA : {printf("TOKEN_RA ");break;}
case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
- // case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}
- // case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
+ /* case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}*/
+ /* case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
int gras_ddt_parse_lex_n_dump(void) {
gras_ddt_parse_tok_num = gras_ddt_parse_lex();
- // gras_ddt_parse_char_pos += strlen(yytext);
+ /* gras_ddt_parse_char_pos += strlen(yytext);*/
return(gras_ddt_parse_tok_num);
}
gras_ddt_parse_tok_num = 0;
}
-// Local variables:
-// mode: c
-// End:
+/* Local variables:*/
+/* mode: c */
+/* End: */
int gras_ddt_parse_char_pos = 0;
int gras_ddt_parse_tok_num = 0;
const char *definition;
- GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse);
+ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
#define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
%}
}
"/*[^g]" { /****************** COMMENTS ************************/
- // constructs like /*g [string] g*/ are not comments but size annotations
+ /* constructs like : */
+ /*g [string] g*/
+ /* are not comments but size annotations */
comment_caller = INITIAL;
BEGIN(comment);
}
case GRAS_DDT_PARSE_TOKEN_LA : {printf("TOKEN_LA ");break;}
case GRAS_DDT_PARSE_TOKEN_RA : {printf("TOKEN_RA ");break;}
case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
- // case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}
- // case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
+ /* case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}*/
+ /* case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
int gras_ddt_parse_lex_n_dump(void) {
gras_ddt_parse_tok_num = gras_ddt_parse_lex();
- // gras_ddt_parse_char_pos += strlen(yytext);
+ /* gras_ddt_parse_char_pos += strlen(yytext);*/
return(gras_ddt_parse_tok_num);
}
gras_ddt_parse_tok_num = 0;
}
-// Local variables:
-// mode: c
-// End:
+/* Local variables:*/
+/* mode: c */
+/* End: */
if (!plug)
RAISE_MALLOC;
- plug->name=strdup(name);
+ plug->name=(char*)strdup(name);
if (!plug->name)
RAISE_MALLOC;
if (! (sock=gras_new(gras_socket_t,1)) )
RAISE_MALLOC;
- DEBUG1("Create a new socket (%p)", sock);
+ DEBUG1("Create a new socket (%p)", (void*)sock);
sock->plugin = NULL;
sock->sd = -1;
TRY(gras_trp_socket_new(0,&sock));
sock->plugin= trp;
sock->peer_port = port;
- sock->peer_name = strdup(host?host:"localhost");
+ sock->peer_name = (char*)strdup(host?host:"localhost");
/* plugin-specific */
errcode= (*trp->socket_client)(trp,
if (!data)
RAISE_MALLOC;
data->in.size = 0;
- // data->buffsize = 32 * 1024 - 4; /* default socket buffsize (32k) - headers */
data->buffsize = 100 * 1024 ; /* 100k */
if (!(data->in.data = (char*)gras_malloc(data->buffsize)))
free(data->out.data);
free(data);
- return super->socket_close(sock);
+ super->socket_close(sock);
}
/**
gras_error_t
gras_cfg_register_str(gras_cfg_t *cfg,const char *entry) {
- char *entrycpy=strdup(entry);
+ char *entrycpy=(char*)strdup(entry);
char *tok;
int min,max;
if (!options || !strlen(options)) { /* nothing to do */
return no_error;
}
- optionlist_cpy=strdup(options);
+ optionlist_cpy=(char*)strdup(options);
DEBUG1("List to parse and set:'%s'",options);
option=optionlist_cpy;
/* Pass the value */
while (option-name<=(len-1) && *option != ' ' && *option != '\n' && *option != '\t') {
- //fprintf(stderr,"Take %c.\n",*option);
+ /*fprintf(stderr,"Take %c.\n",*option);*/
option++;
}
if (option-name == len) {
- //fprintf(stderr,"Boundary=EOL\n");
+ /*fprintf(stderr,"Boundary=EOL\n");*/
option=NULL; /* don't do next iteration */
} else {
- //fprintf(stderr,"Boundary on '%c'. len=%d;option-name=%d\n",*option,len,option-name);
+ /*fprintf(stderr,"Boundary on '%c'. len=%d;option-name=%d\n",*option,len,option-name);*/
/* Pass the following blank chars */
*(option++)='\0';
while (option-name<(len-1) && (*option == ' ' || *option == '\n' || *option == '\t')) {
- // fprintf(stderr,"Ignore a blank char.\n");
+ /* fprintf(stderr,"Ignore a blank char.\n");*/
option++;
}
if (option-name == len-1)
gras_cfg_set_string(gras_cfg_t *cfg,const char*name, const char*val) {
gras_cfgelm_t *cell;
gras_error_t errcode;
- char *newval = strdup(val);
+ char *newval = (char*)strdup(val);
VERB2("Configuration setting: %s=%s",name,val);
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
VERB3("Configuration setting: %s=%s:%d",name,host,port);
if (!val)
RAISE_MALLOC;
- val->name = strdup(name);
+ val->name = (char*)strdup(name);
val->port = port;
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
gras_dict_dump(gras_dict_t *dict,
void_f_pvoid_t *output) {
- printf("Dict %p:\n", dict);
+ printf("Dict %p:\n", (void*)dict);
return gras_dictelm_dump(dict ? dict->head: NULL, output);
}
gras_dictelm_t *head;
};
-static inline
+static _GRAS_INLINE
gras_error_t
_cursor_push_keys(gras_dict_cursor_t *p_cursor,
gras_dictelm_t *p_elm);
#undef gras_dict_CURSOR_DEBUG
-//#define gras_dict_CURSOR_DEBUG 1
+/*#define gras_dict_CURSOR_DEBUG 1*/
/**
* gras_dict_cursor_new:
*
* Sanity check to see if the head contains something
*/
-static inline
+static _GRAS_INLINE
gras_error_t
__cursor_not_null(gras_dict_cursor_t *p_cursor) {
}
-static inline
+static _GRAS_INLINE
gras_error_t
_cursor_push_keys(gras_dict_cursor_t *p_cursor,
gras_dictelm_t *p_elm) {
int i = 0;
static volatile int count = 0; /* ??? */
- CDEBUG1(dict_cursor, "Push childs of %p in the cursor", p_elm);
+ CDEBUG1(dict_cursor, "Push childs of %p in the cursor", (void*)p_elm);
if (p_elm->content) {
TRY(gras_dynar_push(p_cursor->keys, &p_elm->key ));
/*####[ Private prototypes ]#################################################*/
-static inline gras_error_t _gras_dictelm_alloc(char *key,
+static _GRAS_INLINE gras_error_t _gras_dictelm_alloc(char *key,
int offset,
int key_len,
void *data,
/*OUT*/gras_dictelm_t **where);
static void _dictelm_wrapper_free(void*);
-static inline void _str_prefix_lgr(const char *key1,
+static _GRAS_INLINE void _str_prefix_lgr(const char *key1,
int key_len1,
const char *key2,
int key_len2,
int key_len,
int offset);
-static inline
+static _GRAS_INLINE
void
_collapse_if_need(gras_dictelm_t *p_head,
int pos,
/* ---- */
-static inline
+static _GRAS_INLINE
void *
memdup(const void * const ptr,
const size_t length) {
* Change any byte to a printable char
*/
-static inline
+static _GRAS_INLINE
char
_gras_nibble_to_char(unsigned char c) {
c &= 0x0f;
* Change any byte array to a printable string
* The length of string_container should at least be data_len*2+1
*/
-static inline
+static _GRAS_INLINE
char *
_gras_bytes_to_string(char * const ptr,
int data_len,
* Alloc a dict element with no child.
*/
static
-inline
+_GRAS_INLINE
gras_error_t
_gras_dictelm_alloc(char *key,
int key_len,
* Returns the length of the common prefix of @str1 and @str2.
* Do make sure the strings are not null
*/
-static inline
+static _GRAS_INLINE
void
_str_prefix_lgr(const char *key1,
int key_len1,
* Compares two dictelm keys and return their matching (using the same
* convention than @_gras_dict_child_search() )
*/
-static inline
+static _GRAS_INLINE
void
_dict_child_cmp(gras_dictelm_t *p_dict,
int pos,
* handled by previous levels of recursion. In output, that the one counting
* also this level.
*/
-static inline
+static _GRAS_INLINE
void
_gras_dictelm_child_search(gras_dictelm_t *p_elm,
const char *key,
*
* Change the value of the dictelm, making sure to free the old one, if any.
*/
-static inline
+static _GRAS_INLINE
void
_gras_dictelm_change_value(gras_dictelm_t *p_elm,
void *data,
key_len, key,
((p_head && p_head->key) ? p_head->key_len : 6),
((p_head && p_head->key) ? p_head->key : "(head)"),
- offset, p_head);
+ offset, (void*)p_head);
/*** The trivial cases first ***/
gras_dictelm_t *p_child = NULL;
TRY(_gras_dictelm_alloc(key, key_len, offset, data, free_ctn, &p_child));
- CDEBUG1(dict_add, "-> Add a child %p", p_child);
+ CDEBUG1(dict_add, "-> Add a child %p", (void*)p_child);
TRY(gras_dynar_insert_at(p_head->sub, pos, &p_child));
return errcode;
gras_dictelm_t *p_child = NULL;
gras_dynar_get(p_head->sub, pos, &p_child);
- CDEBUG1(dict_add, "-> Change the value of the child %p", p_child);
+ CDEBUG1(dict_add, "-> Change the value of the child %p", (void*)p_child);
_gras_dictelm_change_value(p_child, data, free_ctn);
free(key);
gras_dictelm_t *p_child = NULL;
gras_dynar_get(p_head->sub, pos, &p_child);
- CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", p_child, offset);
+ CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", (void*)p_child, offset);
return _gras_dictelm_set_rec(p_child, key, key_len,
offset, data, free_ctn);
TRY(_gras_dictelm_alloc(key, key_len, old_offset, data, free_ctn, &p_new));
CDEBUG2(dict_add, "-> The child %p become child of new dict (%p)",
- p_child, p_new);
+ (void*)p_child, (void*)p_new);
TRY(gras_dynar_push(p_new->sub, &p_child));
p_child->offset = offset;
NULL, NULL, &p_anc));
CDEBUG3(dict_add, "-> Make a common ancestor %p (%.*s)",
- p_anc, anc_key_len, anc_key);
+ (void*)p_anc, anc_key_len, anc_key);
if (key[offset] < p_child->key[offset]) {
TRY(gras_dynar_push(p_anc->sub, &p_new));
void **data) {
void *res;
- CDEBUG3(dict_search, "Search %.*s in %p", key_len, key, p_head);
+ CDEBUG3(dict_search, "Search %.*s in %p", key_len, key, (void*)p_head);
/*** The trivial case first ***/
int match = 0;
int pos = 0;
- *data = NULL; // Make it ready to answer 'not found' in one operation
+ *data = NULL; /* Make it ready to answer 'not found' in one operation */
/*** Search where is the good child, and how good it is ***/
_gras_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
}
/*----[ _gras_dict_collapse ]------------------------------------------------*/
-static inline
+static _GRAS_INLINE
void
_collapse_if_need(gras_dictelm_t *p_head,
int pos,
int offset) {
gras_dictelm_t *p_child = NULL;
- CDEBUG2(dict_collapse, "Collapse %d of %p... ", pos, p_head); fflush(stdout);
+ CDEBUG2(dict_collapse, "Collapse %d of %p... ", pos, (void*)p_head);
if (pos >= 0) {
/* Remove the child if |it's key| == 0 (meaning it's dead) */
gras_assert0(gras_dynar_length(p_child->sub) == 0,
"Found a dead child with grand childs. Internal error");
- CDEBUG1(dict_collapse, "Remove dead child %p.... ", p_child);
+ CDEBUG1(dict_collapse, "Remove dead child %p.... ", (void*)p_child);
gras_dynar_remove_at(p_head->sub, pos, &p_child);
}
}
gras_dynar_get(p_head->sub, pos, &p_child);
/*DEBUG5("Recurse on child %d of %p to remove %.*s (prefix=%d)",
- pos, p_child, key+offset, key_len-offset,offset);*/
+ pos, (void*)p_child, key+offset, key_len-offset,offset);*/
TRY(_gras_dictelm_remove_rec(p_child, key, key_len, offset));
_collapse_if_need(p_head, pos, old_offset);
if (!p_head)
return no_error;
- printf("[%p] ", p_head);
+ printf("[%p] ", (void*)p_head);
key = p_head->key;
key_len = p_head->key_len;
void
gras_dictelm_print_fct(void *data) {
- printf("tree %p", data);
+ printf("tree %p", (void*)data);
}
(int) (idx), (unsigned long) dynar->used)
#define __check_populated_dynar(dynar) \
gras_assert1(dynar->used, \
- "dynar %p contains nothing",dynar)
+ "dynar %p contains nothing",(void*)dynar)
-
-static inline
-void
-_gras_clear_mem(void * const ptr,
- const size_t length) {
+static _GRAS_INLINE
+void _gras_clear_mem(void * const ptr,
+ const size_t length) {
memset(ptr, 0, length);
}
-static inline
+static _GRAS_INLINE
gras_error_t
_gras_dynar_expand(gras_dynar_t * const dynar,
const int nb) {
const size_t new_length = new_size*elmsize;
char * const new_data = gras_malloc0(elmsize*new_size);
- DEBUG3("expend %p from %lu to %d elements", dynar, (unsigned long)old_size, nb);
+ DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
if (!new_data)
RAISE_MALLOC;
return errcode;
}
-static inline
+static _GRAS_INLINE
void *
_gras_dynar_elm(const gras_dynar_t * const dynar,
const size_t idx) {
return data + idx*elmsize;
}
-static inline
+static _GRAS_INLINE
void
_gras_dynar_get_elm(void * const dst,
const gras_dynar_t * const dynar,
memcpy(dst, elm, elmsize);
}
-static inline
+static _GRAS_INLINE
void
_gras_dynar_put_elm(const gras_dynar_t * const dynar,
const size_t idx,
__sanity_check_dynar(dynar);
- DEBUG1("Reset the dynar %p",dynar);
+ DEBUG1("Reset the dynar %p",(void*)dynar);
if (dynar->free) {
gras_dynar_map(dynar, dynar->free);
}
void * const dst) {
__sanity_check_dynar(dynar);
__check_populated_dynar(dynar);
- DEBUG1("Pop %p",dynar);
+ DEBUG1("Pop %p",(void*)dynar);
gras_dynar_remove_at(dynar, dynar->used-1, dst);
}
int * const cursor) {
__sanity_check_dynar(dynar);
- DEBUG1("Set cursor on %p to the first position",dynar);
+ DEBUG1("Set cursor on %p to the first position",(void*)dynar);
*cursor = 0;
}
const int idx = *cursor;
if (idx >= dynar->used) {
- DEBUG1("Cursor on %p already on last elem",dynar);
+ DEBUG1("Cursor on %p already on last elem",(void*)dynar);
return FALSE;
}
- DEBUG2("Cash out cursor on %p at %d",dynar,idx);
+ DEBUG2("Cash out cursor on %p at %d",(void*)dynar,idx);
_gras_dynar_get_elm(dst, dynar, idx);
}
gras_log_setting_t *set=(gras_log_setting_t*)s;
if (set) {
gras_free(set->catname);
-// free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log
+/* free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log */
}
}
"root", gras_log_priority_uninitialized, 0,
NULL, 0
};
+
GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories");
GRAS_LOG_NEW_SUBCATEGORY(gros,GRAS_LOG_ROOT_CAT,"All GROS categories (gras toolbox)");
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,gros,"Loggings from the logging mecanism itself");
gras_dynar_foreach(gras_log_settings,cursor,setting) {
gras_assert0(setting,"Damnit, NULL cat in the list");
- gras_assert1(setting->catname,"NULL setting(=%p)->catname",setting);
+ gras_assert1(setting->catname,"NULL setting(=%p)->catname",(void*)setting);
if (!strcmp(setting->catname,cat->name)) {
found = 1;
gras_assert0(cat,"NULL category to be given a parent");
gras_assert1(parent,"The parent category of %s is NULL",cat->name);
- // unlink from current parent
+ /* unlink from current parent */
if (cat->threshold != gras_log_priority_uninitialized) {
gras_log_category_t** cpp = &parent->firstChild;
while(*cpp != cat && *cpp != NULL) {
*cpp = cat->nextSibling;
}
- // Set new parent
+ /* Set new parent */
cat->parent = parent;
cat->nextSibling = parent->firstChild;
parent->firstChild = cat;
- // Make sure parent is initialized
+ /* Make sure parent is initialized */
if (parent->threshold == gras_log_priority_uninitialized) {
_cat_init(parent);
}
- // Reset priority
+ /* Reset priority */
cat->threshold = parent->threshold;
cat->isThreshInherited = 1;
-} // log_setParent
+} /* log_setParent */
static void _set_inherited_thresholds(gras_log_category_t* cat) {
gras_log_category_t* child = cat->firstChild;
if (!strncmp(dot + 1, "thresh", min(eq - dot - 1,strlen("thresh")))) {
int i;
- char *neweq=strdup(eq+1);
+ char *neweq=(char*)strdup(eq+1);
char *p=neweq-1;
while (*(++p) != '\0') {
if (! (set = gras_new(gras_log_setting_t,1)) )
RAISE_MALLOC;
- if (!(cs=strdup(control_string)))
+ if (!(cs=(char*)strdup(control_string)))
RAISE_MALLOC;
_cleanup_double_spaces(cs);
mismatch_error);
if (errcode == mismatch_error) {
DEBUG0("Store for further application");
- DEBUG1("push %p to the settings",set);
+ DEBUG1("push %p to the settings",(void*)set);
TRY(gras_dynar_push(gras_log_settings,&set));
/* malloc in advance the next slot */
if (!(set = gras_new(gras_log_setting_t,1))) {
gras_log_event_t* ev,
const char *fmt) {
- // TODO: define a format field in struct for timestamp, etc.
- // struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;
+ /* TODO: define a format field in struct for timestamp, etc.
+ struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;*/
if ((FILE*)(this->appender_data) == NULL)
this->appender_data = (void*)stderr;