/* * linux/tools/lib/string.c * * Copied from linux/lib/string.c, where it is: * * Copyright (C) 1991, 1992 Linus Torvalds * * More specifically, the first copied function was strtobool, which * was introduced by: * * d0f1fed29e6e ("Add a strtobool function matching semantics of existing in kernel equivalents") * Author: Jonathan Cameron */ #include #include #include #include #include /** * memdup - duplicate region of memory * * @src: memory region to duplicate * @len: memory region length */ void *memdup(const void *src, size_t len) { void *p = malloc(len); if (p) memcpy(p, src, len); return p; } /** * strtobool - convert common user inputs into boolean values * @s: input string * @res: result * * This routine returns 0 iff the first character is one of 'Yy1Nn0'. * Otherwise it will return -EINVAL. Value pointed to by res is * updated upon finding a match. */ int strtobool(const char *s, bool *res) { switch (s[0]) { case 'y': case 'Y': case '1': *res = true; break; case 'n': case 'N': case '0': *res = false; break; default: return -EINVAL; } return 0; } /** * strlcpy - Copy a C-string into a sized buffer * @dest: Where to copy the string to * @src: Where to copy the string from * @size: size of destination buffer * * Compatible with *BSD: the result is always a valid * NUL-terminated string that fits in the buffer (unless, * of course, the buffer size is zero). It does not pad * out the result like strncpy() does. * * If libc has strlcpy() then that version will override this * implementation: */ size_t __weak strlcpy(char *dest, const char *src, size_t size) { size_t ret = strlen(src); if (size) { size_t len = (ret >= size) ? size - 1 : ret; memcpy(dest, src, len); dest[len] = '\0'; } return ret; } /arch/s390/util/dwarf-regs.c?id=0a019a28e0ca0af7dc2691d1a9527960b07ad2bb'>treecommitdiff
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2017-01-29 21:00:48 -0800
committerOlof Johansson <olof@lixom.net>2017-01-29 21:00:48 -0800
commit0a019a28e0ca0af7dc2691d1a9527960b07ad2bb (patch)
tree5ee1db9aacacd6af6701fb290e8a294ef3cc2bf2 /tools/perf/arch/s390/util/dwarf-regs.c
parentec026b5020688a8bde5fae9a69ae3c59b66ba3ae (diff)
parent8413299cb3933dade6186bbee8363f190032107e (diff)
Merge tag 'sti-dt-for-v4.10-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/pchotard/sti into fixes
STi DT fix: Since v4.10-rc1, xhci is complaining in loop with : [ 801.953836] usb usb6-port1: Cannot enable. Maybe the USB cable is bad? [ 801.960455] xhci-hcd xhci-hcd.0.auto: Cannot set link state. [ 801.966611] usb usb6-port1: cannot disable (err = -32) set property "snps,dis_u3_susphy_quirk" in DT fix it. * tag 'sti-dt-for-v4.10-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/pchotard/sti: ARM: dts: STiH407-family: set snps,dis_u3_susphy_quirk Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'tools/perf/arch/s390/util/dwarf-regs.c')