make: avoided the warning message when do make.

change: code style, delete some useless spaces(visual code).

eg:

warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result
This commit is contained in:
Yuansheng 2019-06-21 10:45:54 +08:00
parent 410f66bc1a
commit 8e18a995d8
4 changed files with 28 additions and 19 deletions

View file

@ -24,9 +24,11 @@ void r3_tree_build_ag_nodes(Agraph_t * g, Agnode_t * ag_parent_node, const node
char *nodename = NULL; char *nodename = NULL;
if ( e && e->child && e->child->combined_pattern ) { if ( e && e->child && e->child->combined_pattern ) {
asprintf(&nodename,"%s", e->child->combined_pattern); int r = asprintf(&nodename,"%s", e->child->combined_pattern);
if (r) {};
} else { } else {
asprintf(&nodename,"#%d", *node_cnt); int r = asprintf(&nodename,"#%d", *node_cnt);
if (r) {};
} }
agn_child = agnode(g, nodename, 1); agn_child = agnode(g, nodename, 1);

View file

@ -173,7 +173,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
char * p; char * p;
char * cpat = calloc(1, sizeof(char) * 64 * 3); // XXX char * cpat = calloc(1, sizeof(char) * 64 * 3); // XXX
if (!cpat) { if (!cpat) {
asprintf(errstr, "Can not allocate memory"); int r = asprintf(errstr, "Can not allocate memory");
if (r) {};
return -1; return -1;
} }
@ -239,7 +240,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
NULL); /* use default character tables */ NULL); /* use default character tables */
if (n->pcre_pattern == NULL) { if (n->pcre_pattern == NULL) {
if (errstr) { if (errstr) {
asprintf(errstr, "PCRE compilation failed at offset %d: %s, pattern: %s", pcre_erroffset, pcre_error, n->combined_pattern); int r = asprintf(errstr, "PCRE compilation failed at offset %d: %s, pattern: %s", pcre_erroffset, pcre_error, n->combined_pattern);
if (r) {};
} }
return -1; return -1;
} }
@ -250,7 +252,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
n->pcre_extra = pcre_study(n->pcre_pattern, 0, &pcre_error); n->pcre_extra = pcre_study(n->pcre_pattern, 0, &pcre_error);
if (!n->pcre_extra) { if (!n->pcre_extra) {
if (errstr) { if (errstr) {
asprintf(errstr, "PCRE study failed at offset %s, pattern: %s", pcre_error, n->combined_pattern); int r = asprintf(errstr, "PCRE study failed at offset %s, pattern: %s", pcre_error, n->combined_pattern);
if (r) {};
} }
return -1; return -1;
} }

View file

@ -60,7 +60,8 @@ int r3_slug_check(r3_slug_t *s) {
char * r3_slug_to_str(const r3_slug_t *s) { char * r3_slug_to_str(const r3_slug_t *s) {
char *str = NULL; char *str = NULL;
asprintf(&str, "slug: '%.*s', pattern: '%.*s', path: '%.*s'", s->len, s->begin, s->pattern_len, s->pattern, s->path_len, s->path); int r = asprintf(&str, "slug: '%.*s', pattern: '%.*s', path: '%.*s'", s->len, s->begin, s->pattern_len, s->pattern, s->path_len, s->path);
if (r) {};
return str; return str;
} }
@ -139,7 +140,8 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
if (state != 0) { if (state != 0) {
if (errstr) { if (errstr) {
char *err = NULL; char *err = NULL;
asprintf(&err, "Incomplete slug pattern. PATH (%d): '%s', OFFSET: %ld, STATE: %d", needle_len, needle, p - needle, state); int r = asprintf(&err, "Incomplete slug pattern. PATH (%d): '%s', OFFSET: %ld, STATE: %d", needle_len, needle, p - needle, state);
if (r) {};
*errstr = err; *errstr = err;
} }
return -1; return -1;
@ -177,7 +179,8 @@ int r3_slug_count(const char * needle, int len, char **errstr) {
if (state != 0) { if (state != 0) {
if (errstr) { if (errstr) {
char *err = NULL; char *err = NULL;
asprintf(&err, "Incomplete slug pattern. PATTERN (%d): '%s', OFFSET: %ld, STATE: %d", len, needle, p - needle, state); int r = asprintf(&err, "Incomplete slug pattern. PATTERN (%d): '%s', OFFSET: %ld, STATE: %d", len, needle, p - needle, state);
if (r) {};
*errstr = err; *errstr = err;
} }
return -1; return -1;

View file

@ -78,7 +78,8 @@ char * r3_inside_slug(const char * needle, int needle_len, char *offset, char **
if (found_s1 || found_s2) { if (found_s1 || found_s2) {
// wrong slug pattern // wrong slug pattern
if(errstr) { if(errstr) {
asprintf(errstr, "Incomplete slug pattern"); int r = asprintf(errstr, "Incomplete slug pattern");
if (r) {};
} }
return NULL; return NULL;
} }