Merge pull request #124 from iresty/make-WARN

make: avoided the warning message when do make at Ubuntu OS.
This commit is contained in:
Yo-An Lin 2019-06-21 12:55:15 +08:00 committed by GitHub
commit 3f410ef5d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;
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 {
asprintf(&nodename,"#%d", *node_cnt);
int r = asprintf(&nodename,"#%d", *node_cnt);
if (r) {};
}
agn_child = agnode(g, nodename, 1);

View file

@ -173,7 +173,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
char * p;
char * cpat = calloc(1, sizeof(char) * 64 * 3); // XXX
if (!cpat) {
asprintf(errstr, "Can not allocate memory");
int r = asprintf(errstr, "Can not allocate memory");
if (r) {};
return -1;
}
@ -239,7 +240,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
NULL); /* use default character tables */
if (n->pcre_pattern == NULL) {
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;
}
@ -250,7 +252,8 @@ int r3_tree_compile_patterns(R3Node * n, char **errstr) {
n->pcre_extra = pcre_study(n->pcre_pattern, 0, &pcre_error);
if (!n->pcre_extra) {
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;
}

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 *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;
}
@ -139,7 +140,8 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
if (state != 0) {
if (errstr) {
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;
}
return -1;
@ -177,7 +179,8 @@ int r3_slug_count(const char * needle, int len, char **errstr) {
if (state != 0) {
if (errstr) {
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;
}
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) {
// wrong slug pattern
if(errstr) {
asprintf(errstr, "Incomplete slug pattern");
int r = asprintf(errstr, "Incomplete slug pattern");
if (r) {};
}
return NULL;
}