9
0
Fork 0
Commit Graph

4 Commits

Author SHA1 Message Date
Sascha Hauer 22b8e9415d string: Introduce strtobool
We have at least two places which convert a string to a boolean type,
so create a common function for this. strtobool treats

- any positive (nonzero) number as true
- "0" as false
- "true" (case insensitive) as true
- "false" (case insensitive) as false

Every other value results in an error and the input *val is not
modified. The caller is expected to initialize *val with the correct
default before calling strtobool.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-29 11:29:25 +02:00
Sascha Hauer 54f55d79d9 string: Add (x)memdup
It's a common task to duplicate some memory. Add (x)memdup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:54 +01:00
Sascha Hauer 839aaaf9ef add protection from double inclusion in string.h 2008-03-31 21:55:34 +02:00
Sascha Hauer e35ccd2f9c add string.h 2007-09-27 12:07:13 +02:00