]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: http: remove a warning on strndup
authorWilly Tarreau <w@1wt.eu>
Fri, 25 Apr 2014 19:38:08 +0000 (21:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Apr 2014 19:39:17 +0000 (21:39 +0200)
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.

src/proto_http.c

index 8467dbc099454aaafdcacd85be963c396dbac091..90b73dacd7771941d31346954c83131a847bbc69 100644 (file)
@@ -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;