Lines Matching +full:num +full:- +full:strings
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Helpers for formatting and printing strings
22 * string_get_size - get the size in the specified units
113 remainder -= 1000; in string_get_size()
164 u8 num; in unescape_octal() local
169 num = (*q++) & 7; in unescape_octal()
170 while (num < 32 && isodigit(*q) && (q - *src < 3)) { in unescape_octal()
171 num <<= 3; in unescape_octal()
172 num += (*q++) & 7; in unescape_octal()
174 *p = num; in unescape_octal()
184 u8 num; in unescape_hex() local
189 num = digit = hex_to_bin(*q++); in unescape_hex()
196 num = (num << 4) | digit; in unescape_hex()
198 *p = num; in unescape_hex()
230 * string_unescape - unquote characters in the given string
243 * destination buffer will always be NULL-terminated. Source string must be
244 * NULL-terminated as well. The supported flags are::
247 * '\f' - form feed
248 * '\n' - new line
249 * '\r' - carriage return
250 * '\t' - horizontal tab
251 * '\v' - vertical tab
253 * '\NNN' - byte with octal value NNN (1 to 3 digits)
255 * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
257 * '\"' - double quote
258 * '\\' - backslash
259 * '\a' - alert (BEL)
260 * '\e' - escape
272 while (*src && --size) { in string_unescape()
275 size--; in string_unescape()
299 return out - dst; in string_unescape()
440 * string_escape_mem - quote characters in the given memory buffer
446 * @only: NULL-terminated string containing characters used to limit
458 * must go as-is to the output.
465 * destination buffer will not be NULL-terminated, thus caller have to append
469 * '\f' - form feed
470 * '\n' - new line
471 * '\r' - carriage return
472 * '\t' - horizontal tab
473 * '\v' - vertical tab
475 * '\\' - backslash
476 * '\a' - alert (BEL)
477 * '\e' - escape
479 * '\0' - null
481 * '\NNN' - byte with octal value NNN (3 digits)
485 * escape only non-printable characters (checked by isprint)
489 * '\xHH' - byte with hexadecimal value HH (2 digits)
504 while (isz--) { in string_escape_mem()
509 * - the character is printable, when @flags has in string_escape_mem()
511 * - the @only string is supplied and does not contain a in string_escape_mem()
513 * - the character doesn't fall into a class of symbols in string_escape_mem()
542 return p - dst; in string_escape_mem()
552 while (isz--) { in string_escape_mem_ascii()
561 return p - dst; in string_escape_mem_ascii()
593 * Returns allocated NULL-terminated string containing process
594 * command line, with inter-argument NULLs replaced with spaces,
606 res = get_cmdline(task, buffer, PAGE_SIZE - 1); in kstrdup_quotable_cmdline()
609 /* Collapse trailing NULLs, leave res pointing to last non-NULL. */ in kstrdup_quotable_cmdline()
610 while (--res >= 0 && buffer[res] == '\0') in kstrdup_quotable_cmdline()
613 /* Replace inter-argument NULLs. */ in kstrdup_quotable_cmdline()
626 * Returns allocated NULL-terminated string containing pathname,
654 * kfree_strarray - free a number of dynamically allocated strings contained
657 * @array: Dynamically allocated array of strings to free.
658 * @n: Number of strings (starting from the beginning of the array) to free.
660 * Passing a non-NULL @array and @n == 0 as well as NULL @array are valid
661 * use-cases. If @array is NULL, the function does nothing.