From: Willy Tarreau Date: Fri, 25 Apr 2014 19:38:08 +0000 (+0200) Subject: BUILD: http: remove a warning on strndup X-Git-Tag: v1.5-dev24~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c09c2ceae796d0f48ec2711a200114f8ba928dc;p=thirdparty%2Fhaproxy.git BUILD: http: remove a warning on strndup The latest commit about set-map/add-acl/... causes this warning for me : src/proto_http.c: In function 'parse_http_req_cond': src/proto_http.c:8863: warning: implicit declaration of function 'strndup' src/proto_http.c:8863: warning: incompatible implicit declaration of built-in function 'strndup' src/proto_http.c:8890: warning: incompatible implicit declaration of built-in function 'strndup' src/proto_http.c:8917: warning: incompatible implicit declaration of built-in function 'strndup' src/proto_http.c:8944: warning: incompatible implicit declaration of built-in function 'strndup' Use my_strndup() instead of strndup() which is not portable. No backport needed. --- diff --git a/src/proto_http.c b/src/proto_http.c index 8467dbc099..90b73dacd7 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -8860,7 +8860,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i * '+ 8' for 'add-acl(' * '- 9' for 'add-acl(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -8887,7 +8887,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i * '+ 8' for 'del-acl(' * '- 9' for 'del-acl(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -8914,7 +8914,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i * '+ 8' for 'del-map(' * '- 9' for 'del-map(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -8941,7 +8941,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i * '+ 8' for 'set-map(' * '- 9' for 'set-map(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -9160,7 +9160,7 @@ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, i * '+ 8' for 'add-acl(' * '- 9' for 'add-acl(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -9188,7 +9188,7 @@ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, i * '+ 8' for 'del-acl(' * '- 9' for 'del-acl(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -9215,7 +9215,7 @@ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, i * '+ 8' for 'del-map(' * '- 9' for 'del-map(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1; @@ -9242,7 +9242,7 @@ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, i * '+ 8' for 'set-map(' * '- 9' for 'set-map(' + trailing ')' */ - rule->arg.map.ref = strndup(args[0] + 8, strlen(args[0]) - 9); + rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9); cur_arg = 1;