int warnifnotcap(struct proxy *proxy, int cap, const char *file, int line, const char *arg, const char *hint);
int failifnotcap(struct proxy *proxy, int cap, const char *file, int line, const char *arg, const char *hint);
void cfg_dump_registered_keywords();
+int list_append_word(struct list *li, const char *str, char **err);
/* simplified way to define a section parser */
#define REGISTER_CONFIG_SECTION(name, parse, post) \
* The caller is responsible for freeing the <err> and <str> copy
* memory area using free()
*/
-struct list;
-int list_append_word(struct list *li, const char *str, char **err);
int dump_text(struct buffer *out, const char *buf, int bsize);
int dump_binary(struct buffer *out, const char *buf, int bsize);
return ret;
}
+/* append a copy of string <str> (in a wordlist) at the end of the list <li>
+ * On failure : return 0 and <err> filled with an error message.
+ * The caller is responsible for freeing the <err> and <str> copy
+ * memory area using free()
+ */
+int list_append_word(struct list *li, const char *str, char **err)
+{
+ struct wordlist *wl;
+
+ wl = calloc(1, sizeof(*wl));
+ if (!wl) {
+ memprintf(err, "out of memory");
+ goto fail_wl;
+ }
+
+ wl->s = strdup(str);
+ if (!wl->s) {
+ memprintf(err, "out of memory");
+ goto fail_wl_s;
+ }
+
+ LIST_APPEND(li, &wl->list);
+
+ return 1;
+
+fail_wl_s:
+ free(wl->s);
+fail_wl:
+ free(wl);
+ return 0;
+}
+
/*
* This function reads and parses the configuration file given in the argument.
* Returns the error code, 0 if OK, -1 if the config file couldn't be opened,
return code | ((p-(unsigned char *)s)&0x0f);
}
-/* append a copy of string <str> (in a wordlist) at the end of the list <li>
- * On failure : return 0 and <err> filled with an error message.
- * The caller is responsible for freeing the <err> and <str> copy
- * memory area using free()
- */
-int list_append_word(struct list *li, const char *str, char **err)
-{
- struct wordlist *wl;
-
- wl = calloc(1, sizeof(*wl));
- if (!wl) {
- memprintf(err, "out of memory");
- goto fail_wl;
- }
-
- wl->s = strdup(str);
- if (!wl->s) {
- memprintf(err, "out of memory");
- goto fail_wl_s;
- }
-
- LIST_APPEND(li, &wl->list);
-
- return 1;
-
-fail_wl_s:
- free(wl->s);
-fail_wl:
- free(wl);
- return 0;
-}
-
/* indicates if a memory location may safely be read or not. The trick consists
* in performing a harmless syscall using this location as an input and letting
* the operating system report whether it's OK or not. For this we have the