]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/xstrto.h
Merge from trunk. and Save Comm::Connection in IoCallback
[thirdparty/squid.git] / compat / xstrto.h
1 #ifndef _SQUID_XSTRTO_H
2 #define _SQUID_XSTRTO_H
3
4 #if HAVE_STDBOOL_H
5 #include <stdbool.h>
6 #endif
7
8 /**
9 * xstrtou{i,l} - string to number conversion
10 * \param s input string
11 * \param end like strtoul's "end" pointer
12 * \param value pointer for result. Undefined on failure
13 * \param min minimum accepted value
14 * \param max maximum accepted value
15 *
16 * If @end is NULL, we assume the caller wants a "strict strtoul", and hence
17 * "15a" is rejected.
18 * In either case, the value obtained is compared for min-max compliance.
19 * Base is always 0, i.e. autodetect depending on @s.
20 *
21 * \return true/false whether number was accepted. On failure, *value has
22 * undefined contents.
23 */
24 bool xstrtoul(const char *s, char **end, unsigned long *value,
25 unsigned long min, unsigned long max);
26
27 bool xstrtoui(const char *s, char **end, unsigned int *value,
28 unsigned int min, unsigned int max);
29
30 #endif /* _SQUID_XSTRTO_H */