mirror of
https://github.com/systemd/systemd.git
synced 2026-07-12 18:44:14 +00:00
various: move ptr indicator to return value
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "hexdecoct.h"
|
||||
#include "macro.h"
|
||||
|
||||
char *bus_label_escape(const char *s) {
|
||||
char* bus_label_escape(const char *s) {
|
||||
char *r, *t;
|
||||
const char *f;
|
||||
|
||||
@@ -42,7 +42,7 @@ char *bus_label_escape(const char *s) {
|
||||
return r;
|
||||
}
|
||||
|
||||
char *bus_label_unescape_n(const char *f, size_t l) {
|
||||
char* bus_label_unescape_n(const char *f, size_t l) {
|
||||
char *r, *t;
|
||||
size_t i;
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
#include "string-util.h"
|
||||
|
||||
char *bus_label_escape(const char *s);
|
||||
char *bus_label_unescape_n(const char *f, size_t l);
|
||||
char* bus_label_escape(const char *s);
|
||||
char* bus_label_unescape_n(const char *f, size_t l);
|
||||
|
||||
static inline char *bus_label_unescape(const char *f) {
|
||||
static inline char* bus_label_unescape(const char *f) {
|
||||
return bus_label_unescape_n(f, strlen_ptr(f));
|
||||
}
|
||||
|
||||
@@ -1691,7 +1691,7 @@ int cg_escape(const char *p, char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *cg_unescape(const char *p) {
|
||||
char* cg_unescape(const char *p) {
|
||||
assert(p);
|
||||
|
||||
/* The return value of this function (unlike cg_escape())
|
||||
|
||||
@@ -298,7 +298,7 @@ int cg_path_decode_unit(const char *cgroup, char **ret_unit);
|
||||
|
||||
bool cg_needs_escape(const char *p);
|
||||
int cg_escape(const char *p, char **ret);
|
||||
char *cg_unescape(const char *p) _pure_;
|
||||
char* cg_unescape(const char *p) _pure_;
|
||||
|
||||
bool cg_controller_is_valid(const char *p);
|
||||
|
||||
|
||||
@@ -552,7 +552,7 @@ char* strv_env_get_n(char * const *l, const char *name, size_t k, ReplaceEnvFlag
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strv_env_pairs_get(char **l, const char *name) {
|
||||
char* strv_env_pairs_get(char **l, const char *name) {
|
||||
char *result = NULL;
|
||||
|
||||
assert(name);
|
||||
|
||||
@@ -59,7 +59,7 @@ static inline char* strv_env_get(char * const *x, const char *n) {
|
||||
return strv_env_get_n(x, n, SIZE_MAX, 0);
|
||||
}
|
||||
|
||||
char *strv_env_pairs_get(char **l, const char *name) _pure_;
|
||||
char* strv_env_pairs_get(char **l, const char *name) _pure_;
|
||||
|
||||
int getenv_bool(const char *p);
|
||||
int secure_getenv_bool(const char *p);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
|
||||
char *hw_addr_to_string_full(
|
||||
char* hw_addr_to_string_full(
|
||||
const struct hw_addr_data *addr,
|
||||
HardwareAddressToStringFlags flags,
|
||||
char buffer[static HW_ADDR_TO_STRING_MAX]) {
|
||||
|
||||
@@ -36,11 +36,11 @@ typedef enum HardwareAddressToStringFlags {
|
||||
} HardwareAddressToStringFlags;
|
||||
|
||||
#define HW_ADDR_TO_STRING_MAX (3*HW_ADDR_MAX_SIZE)
|
||||
char *hw_addr_to_string_full(
|
||||
char* hw_addr_to_string_full(
|
||||
const struct hw_addr_data *addr,
|
||||
HardwareAddressToStringFlags flags,
|
||||
char buffer[static HW_ADDR_TO_STRING_MAX]);
|
||||
static inline char *hw_addr_to_string(const struct hw_addr_data *addr, char buffer[static HW_ADDR_TO_STRING_MAX]) {
|
||||
static inline char* hw_addr_to_string(const struct hw_addr_data *addr, char buffer[static HW_ADDR_TO_STRING_MAX]) {
|
||||
return hw_addr_to_string_full(addr, 0, buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ const char* accmode_to_string(int flags) {
|
||||
}
|
||||
}
|
||||
|
||||
char *format_proc_pid_fd_path(char buf[static PROC_PID_FD_PATH_MAX], pid_t pid, int fd) {
|
||||
char* format_proc_pid_fd_path(char buf[static PROC_PID_FD_PATH_MAX], pid_t pid, int fd) {
|
||||
assert(buf);
|
||||
assert(fd >= 0);
|
||||
assert(pid >= 0);
|
||||
|
||||
@@ -141,7 +141,7 @@ int fds_are_same_mount(int fd1, int fd2);
|
||||
#define PROC_FD_PATH_MAX \
|
||||
(STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int))
|
||||
|
||||
static inline char *format_proc_fd_path(char buf[static PROC_FD_PATH_MAX], int fd) {
|
||||
static inline char* format_proc_fd_path(char buf[static PROC_FD_PATH_MAX], int fd) {
|
||||
assert(buf);
|
||||
assert(fd >= 0);
|
||||
assert_se(snprintf_ok(buf, PROC_FD_PATH_MAX, "/proc/self/fd/%i", fd));
|
||||
@@ -155,7 +155,7 @@ static inline char *format_proc_fd_path(char buf[static PROC_FD_PATH_MAX], int f
|
||||
#define PROC_PID_FD_PATH_MAX \
|
||||
(STRLEN("/proc//fd/") + DECIMAL_STR_MAX(pid_t) + DECIMAL_STR_MAX(int))
|
||||
|
||||
char *format_proc_pid_fd_path(char buf[static PROC_PID_FD_PATH_MAX], pid_t pid, int fd);
|
||||
char* format_proc_pid_fd_path(char buf[static PROC_PID_FD_PATH_MAX], pid_t pid, int fd);
|
||||
|
||||
/* Kinda the same as FORMAT_PROC_FD_PATH(), but goes by PID rather than "self" symlink */
|
||||
#define FORMAT_PROC_PID_FD_PATH(pid, fd) \
|
||||
|
||||
@@ -37,7 +37,7 @@ int format_ifname_full_alloc(int ifindex, FormatIfnameFlag flag, char **ret) {
|
||||
return strdup_to(ret, buf);
|
||||
}
|
||||
|
||||
char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
|
||||
char* format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
|
||||
typedef struct {
|
||||
const char *suffix;
|
||||
uint64_t factor;
|
||||
|
||||
@@ -81,7 +81,7 @@ static inline int format_ifname_alloc(int ifindex, char **ret) {
|
||||
return format_ifname_full_alloc(ifindex, 0, ret);
|
||||
}
|
||||
|
||||
static inline char *_format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]) {
|
||||
static inline char* _format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]) {
|
||||
(void) format_ifname_full(ifindex, flag, buf);
|
||||
return buf;
|
||||
}
|
||||
@@ -97,10 +97,10 @@ typedef enum {
|
||||
|
||||
#define FORMAT_BYTES_MAX 16U
|
||||
|
||||
char *format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) _warn_unused_result_;
|
||||
char* format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) _warn_unused_result_;
|
||||
|
||||
_warn_unused_result_
|
||||
static inline char *format_bytes(char *buf, size_t l, uint64_t t) {
|
||||
static inline char* format_bytes(char *buf, size_t l, uint64_t t) {
|
||||
return format_bytes_full(buf, l, t, FORMAT_BYTES_USE_IEC | FORMAT_BYTES_BELOW_POINT | FORMAT_BYTES_TRAILING_B);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ int unhexchar(char c) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
char *hexmem(const void *p, size_t l) {
|
||||
char* hexmem(const void *p, size_t l) {
|
||||
const uint8_t *x;
|
||||
char *r, *z;
|
||||
|
||||
@@ -188,7 +188,7 @@ int unbase32hexchar(char c) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
char *base32hexmem(const void *p, size_t l, bool padding) {
|
||||
char* base32hexmem(const void *p, size_t l, bool padding) {
|
||||
char *r, *z;
|
||||
const uint8_t *x;
|
||||
size_t len;
|
||||
|
||||
@@ -17,7 +17,7 @@ int undecchar(char c) _const_;
|
||||
char hexchar(int x) _const_;
|
||||
int unhexchar(char c) _const_;
|
||||
|
||||
char *hexmem(const void *p, size_t l);
|
||||
char* hexmem(const void *p, size_t l);
|
||||
int unhexmem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size);
|
||||
static inline int unhexmem(const char *p, void **ret_data, size_t *ret_size) {
|
||||
return unhexmem_full(p, SIZE_MAX, false, ret_data, ret_size);
|
||||
@@ -30,7 +30,7 @@ char base64char(int x) _const_;
|
||||
char urlsafe_base64char(int x) _const_;
|
||||
int unbase64char(char c) _const_;
|
||||
|
||||
char *base32hexmem(const void *p, size_t l, bool padding);
|
||||
char* base32hexmem(const void *p, size_t l, bool padding);
|
||||
int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *len);
|
||||
|
||||
ssize_t base64mem_full(const void *p, size_t l, size_t line_break, char **ret);
|
||||
|
||||
@@ -253,7 +253,7 @@ static bool relaxed_equal_char(char a, char b) {
|
||||
(a == '-' && b == '_');
|
||||
}
|
||||
|
||||
char *proc_cmdline_key_startswith(const char *s, const char *prefix) {
|
||||
char* proc_cmdline_key_startswith(const char *s, const char *prefix) {
|
||||
assert(s);
|
||||
assert(prefix);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ int proc_cmdline_get_bool(const char *key, ProcCmdlineFlags flags, bool *ret);
|
||||
int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...);
|
||||
#define proc_cmdline_get_key_many(flags, ...) proc_cmdline_get_key_many_internal(flags, __VA_ARGS__, NULL)
|
||||
|
||||
char *proc_cmdline_key_startswith(const char *s, const char *prefix);
|
||||
char* proc_cmdline_key_startswith(const char *s, const char *prefix);
|
||||
bool proc_cmdline_key_streq(const char *x, const char *y);
|
||||
|
||||
/* A little helper call, to be used in proc_cmdline_parse_t callbacks */
|
||||
|
||||
@@ -36,7 +36,7 @@ static int get_variable(const char *b, char **r) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *replace_var(const char *text, char *(*lookup)(const char *variable, void *userdata), void *userdata) {
|
||||
char* replace_var(const char *text, char *(*lookup)(const char *variable, void *userdata), void *userdata) {
|
||||
char *r, *t;
|
||||
const char *f;
|
||||
size_t l;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
char *replace_var(const char *text, char *(*lookup)(const char *variable, void *userdata), void *userdata);
|
||||
char* replace_var(const char *text, char *(*lookup)(const char *variable, void *userdata), void *userdata);
|
||||
|
||||
@@ -46,7 +46,7 @@ char* first_word(const char *s, const char *word) {
|
||||
return (char*) nw;
|
||||
}
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
char* strnappend(const char *s, const char *suffix, size_t b) {
|
||||
size_t a;
|
||||
char *r;
|
||||
|
||||
@@ -77,7 +77,7 @@ char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
return r;
|
||||
}
|
||||
|
||||
char *strjoin_real(const char *x, ...) {
|
||||
char* strjoin_real(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l = 1;
|
||||
char *r, *p;
|
||||
@@ -109,7 +109,7 @@ char *strjoin_real(const char *x, ...) {
|
||||
return r;
|
||||
}
|
||||
|
||||
char *strstrip(char *s) {
|
||||
char* strstrip(char *s) {
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
@@ -118,7 +118,7 @@ char *strstrip(char *s) {
|
||||
return delete_trailing_chars(skip_leading_chars(s, WHITESPACE), WHITESPACE);
|
||||
}
|
||||
|
||||
char *delete_chars(char *s, const char *bad) {
|
||||
char* delete_chars(char *s, const char *bad) {
|
||||
char *f, *t;
|
||||
|
||||
/* Drops all specified bad characters, regardless where in the string */
|
||||
@@ -141,7 +141,7 @@ char *delete_chars(char *s, const char *bad) {
|
||||
return s;
|
||||
}
|
||||
|
||||
char *delete_trailing_chars(char *s, const char *bad) {
|
||||
char* delete_trailing_chars(char *s, const char *bad) {
|
||||
char *c = s;
|
||||
|
||||
/* Drops all specified bad characters, at the end of the string */
|
||||
@@ -161,7 +161,7 @@ char *delete_trailing_chars(char *s, const char *bad) {
|
||||
return s;
|
||||
}
|
||||
|
||||
char *truncate_nl_full(char *s, size_t *ret_len) {
|
||||
char* truncate_nl_full(char *s, size_t *ret_len) {
|
||||
size_t n;
|
||||
|
||||
assert(s);
|
||||
@@ -189,7 +189,7 @@ char ascii_toupper(char x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
char *ascii_strlower(char *t) {
|
||||
char* ascii_strlower(char *t) {
|
||||
assert(t);
|
||||
|
||||
for (char *p = t; *p; p++)
|
||||
@@ -198,7 +198,7 @@ char *ascii_strlower(char *t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
char *ascii_strupper(char *t) {
|
||||
char* ascii_strupper(char *t) {
|
||||
assert(t);
|
||||
|
||||
for (char *p = t; *p; p++)
|
||||
@@ -207,7 +207,7 @@ char *ascii_strupper(char *t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
char *ascii_strlower_n(char *t, size_t n) {
|
||||
char* ascii_strlower_n(char *t, size_t n) {
|
||||
if (n <= 0)
|
||||
return t;
|
||||
|
||||
@@ -389,7 +389,7 @@ static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_le
|
||||
return t;
|
||||
}
|
||||
|
||||
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
|
||||
char* ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
|
||||
size_t x, k, len, len2;
|
||||
const char *i, *j;
|
||||
int r;
|
||||
@@ -524,7 +524,7 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
|
||||
return e;
|
||||
}
|
||||
|
||||
char *cellescape(char *buf, size_t len, const char *s) {
|
||||
char* cellescape(char *buf, size_t len, const char *s) {
|
||||
/* Escape and ellipsize s into buffer buf of size len. Only non-control ASCII
|
||||
* characters are copied as they are, everything else is escaped. The result
|
||||
* is different then if escaping and ellipsization was performed in two
|
||||
@@ -630,7 +630,7 @@ int strgrowpad0(char **s, size_t l) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strreplace(const char *text, const char *old_string, const char *new_string) {
|
||||
char* strreplace(const char *text, const char *old_string, const char *new_string) {
|
||||
size_t l, old_len, new_len;
|
||||
char *t, *ret = NULL;
|
||||
const char *f;
|
||||
@@ -692,7 +692,7 @@ static void advance_offsets(
|
||||
shift[1] += size;
|
||||
}
|
||||
|
||||
char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||
char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||
const char *begin = NULL;
|
||||
enum {
|
||||
STATE_OTHER,
|
||||
@@ -824,7 +824,7 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||
return *ibuf;
|
||||
}
|
||||
|
||||
char *strextend_with_separator_internal(char **x, const char *separator, ...) {
|
||||
char* strextend_with_separator_internal(char **x, const char *separator, ...) {
|
||||
size_t f, l, l_separator;
|
||||
bool need_separator;
|
||||
char *nr, *p;
|
||||
@@ -980,7 +980,7 @@ oom:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
char *strextendn(char **x, const char *s, size_t l) {
|
||||
char* strextendn(char **x, const char *s, size_t l) {
|
||||
assert(x);
|
||||
assert(s || l == 0);
|
||||
|
||||
@@ -1007,7 +1007,7 @@ char *strextendn(char **x, const char *s, size_t l) {
|
||||
return *x;
|
||||
}
|
||||
|
||||
char *strrep(const char *s, unsigned n) {
|
||||
char* strrep(const char *s, unsigned n) {
|
||||
char *r, *p;
|
||||
size_t l;
|
||||
|
||||
@@ -1288,7 +1288,7 @@ bool streq_skip_trailing_chars(const char *s1, const char *s2, const char *ok) {
|
||||
return in_charset(s1, ok) && in_charset(s2, ok);
|
||||
}
|
||||
|
||||
char *string_replace_char(char *str, char old_char, char new_char) {
|
||||
char* string_replace_char(char *str, char old_char, char new_char) {
|
||||
assert(str);
|
||||
assert(old_char != '\0');
|
||||
assert(new_char != '\0');
|
||||
@@ -1358,14 +1358,14 @@ size_t strspn_from_end(const char *str, const char *accept) {
|
||||
return n;
|
||||
}
|
||||
|
||||
char *strdupspn(const char *a, const char *accept) {
|
||||
char* strdupspn(const char *a, const char *accept) {
|
||||
if (isempty(a) || isempty(accept))
|
||||
return strdup("");
|
||||
|
||||
return strndup(a, strspn(a, accept));
|
||||
}
|
||||
|
||||
char *strdupcspn(const char *a, const char *reject) {
|
||||
char* strdupcspn(const char *a, const char *reject) {
|
||||
if (isempty(a))
|
||||
return strdup("");
|
||||
if (isempty(reject))
|
||||
@@ -1374,7 +1374,7 @@ char *strdupcspn(const char *a, const char *reject) {
|
||||
return strndup(a, strcspn(a, reject));
|
||||
}
|
||||
|
||||
char *find_line_startswith(const char *haystack, const char *needle) {
|
||||
char* find_line_startswith(const char *haystack, const char *needle) {
|
||||
char *p;
|
||||
|
||||
assert(haystack);
|
||||
@@ -1485,7 +1485,7 @@ ssize_t strlevenshtein(const char *x, const char *y) {
|
||||
return t1[yl];
|
||||
}
|
||||
|
||||
char *strrstr(const char *haystack, const char *needle) {
|
||||
char* strrstr(const char *haystack, const char *needle) {
|
||||
/* Like strstr() but returns the last rather than the first occurrence of "needle" in "haystack". */
|
||||
|
||||
if (!haystack || !needle)
|
||||
|
||||
@@ -33,7 +33,7 @@ static inline char* strstr_ptr(const char *haystack, const char *needle) {
|
||||
return strstr(haystack, needle);
|
||||
}
|
||||
|
||||
static inline char *strstrafter(const char *haystack, const char *needle) {
|
||||
static inline char* strstrafter(const char *haystack, const char *needle) {
|
||||
char *p;
|
||||
|
||||
/* Returns NULL if not found, or pointer to first character after needle if found */
|
||||
@@ -104,11 +104,11 @@ static inline const char* empty_or_dash_to_null(const char *p) {
|
||||
(typeof(p)) (empty_or_dash(_p) ? NULL : _p); \
|
||||
})
|
||||
|
||||
char *first_word(const char *s, const char *word) _pure_;
|
||||
char* first_word(const char *s, const char *word) _pure_;
|
||||
|
||||
char *strnappend(const char *s, const char *suffix, size_t length);
|
||||
char* strnappend(const char *s, const char *suffix, size_t length);
|
||||
|
||||
char *strjoin_real(const char *x, ...) _sentinel_;
|
||||
char* strjoin_real(const char *x, ...) _sentinel_;
|
||||
#define strjoin(a, ...) strjoin_real((a), __VA_ARGS__, NULL)
|
||||
|
||||
#define strjoina(a, ...) \
|
||||
@@ -126,11 +126,11 @@ char *strjoin_real(const char *x, ...) _sentinel_;
|
||||
_d_; \
|
||||
})
|
||||
|
||||
char *strstrip(char *s);
|
||||
char *delete_chars(char *s, const char *bad);
|
||||
char *delete_trailing_chars(char *s, const char *bad);
|
||||
char *truncate_nl_full(char *s, size_t *ret_len);
|
||||
static inline char *truncate_nl(char *s) {
|
||||
char* strstrip(char *s);
|
||||
char* delete_chars(char *s, const char *bad);
|
||||
char* delete_trailing_chars(char *s, const char *bad);
|
||||
char* truncate_nl_full(char *s, size_t *ret_len);
|
||||
static inline char* truncate_nl(char *s) {
|
||||
return truncate_nl_full(s, NULL);
|
||||
}
|
||||
|
||||
@@ -145,11 +145,11 @@ static inline char* skip_leading_chars(const char *s, const char *bad) {
|
||||
}
|
||||
|
||||
char ascii_tolower(char x);
|
||||
char *ascii_strlower(char *s);
|
||||
char *ascii_strlower_n(char *s, size_t n);
|
||||
char* ascii_strlower(char *s);
|
||||
char* ascii_strlower_n(char *s, size_t n);
|
||||
|
||||
char ascii_toupper(char x);
|
||||
char *ascii_strupper(char *s);
|
||||
char* ascii_strupper(char *s);
|
||||
|
||||
int ascii_strcasecmp_n(const char *a, const char *b, size_t n);
|
||||
int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m);
|
||||
@@ -172,12 +172,12 @@ static inline bool char_is_cc(char p) {
|
||||
}
|
||||
bool string_has_cc(const char *p, const char *ok) _pure_;
|
||||
|
||||
char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_columns, unsigned percent);
|
||||
static inline char *ellipsize(const char *s, size_t length, unsigned percent) {
|
||||
char* ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_columns, unsigned percent);
|
||||
static inline char* ellipsize(const char *s, size_t length, unsigned percent) {
|
||||
return ellipsize_mem(s, strlen(s), length, percent);
|
||||
}
|
||||
|
||||
char *cellescape(char *buf, size_t len, const char *s);
|
||||
char* cellescape(char *buf, size_t len, const char *s);
|
||||
|
||||
/* This limit is arbitrary, enough to give some idea what the string contains */
|
||||
#define CELLESCAPE_DEFAULT_LENGTH 64
|
||||
@@ -186,20 +186,20 @@ char* strshorten(char *s, size_t l);
|
||||
|
||||
int strgrowpad0(char **s, size_t l);
|
||||
|
||||
char *strreplace(const char *text, const char *old_string, const char *new_string);
|
||||
char* strreplace(const char *text, const char *old_string, const char *new_string);
|
||||
|
||||
char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]);
|
||||
char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]);
|
||||
|
||||
char *strextend_with_separator_internal(char **x, const char *separator, ...) _sentinel_;
|
||||
char* strextend_with_separator_internal(char **x, const char *separator, ...) _sentinel_;
|
||||
#define strextend_with_separator(x, separator, ...) strextend_with_separator_internal(x, separator, __VA_ARGS__, NULL)
|
||||
#define strextend(x, ...) strextend_with_separator_internal(x, NULL, __VA_ARGS__, NULL)
|
||||
|
||||
char *strextendn(char **x, const char *s, size_t l);
|
||||
char* strextendn(char **x, const char *s, size_t l);
|
||||
|
||||
int strextendf_with_separator(char **x, const char *separator, const char *format, ...) _printf_(3,4);
|
||||
#define strextendf(x, ...) strextendf_with_separator(x, NULL, __VA_ARGS__)
|
||||
|
||||
char *strrep(const char *s, unsigned n);
|
||||
char* strrep(const char *s, unsigned n);
|
||||
|
||||
#define strrepa(s, n) \
|
||||
({ \
|
||||
@@ -285,7 +285,7 @@ static inline int string_contains_word(const char *string, const char *separator
|
||||
|
||||
bool streq_skip_trailing_chars(const char *s1, const char *s2, const char *ok);
|
||||
|
||||
char *string_replace_char(char *str, char old_char, char new_char);
|
||||
char* string_replace_char(char *str, char old_char, char new_char);
|
||||
|
||||
typedef enum MakeCStringMode {
|
||||
MAKE_CSTRING_REFUSE_TRAILING_NUL,
|
||||
@@ -299,10 +299,10 @@ int make_cstring(const char *s, size_t n, MakeCStringMode mode, char **ret);
|
||||
|
||||
size_t strspn_from_end(const char *str, const char *accept);
|
||||
|
||||
char *strdupspn(const char *a, const char *accept);
|
||||
char *strdupcspn(const char *a, const char *reject);
|
||||
char* strdupspn(const char *a, const char *accept);
|
||||
char* strdupcspn(const char *a, const char *reject);
|
||||
|
||||
char *find_line_startswith(const char *haystack, const char *needle);
|
||||
char* find_line_startswith(const char *haystack, const char *needle);
|
||||
|
||||
bool version_is_valid(const char *s);
|
||||
|
||||
@@ -310,4 +310,4 @@ bool version_is_valid_versionspec(const char *s);
|
||||
|
||||
ssize_t strlevenshtein(const char *x, const char *y);
|
||||
|
||||
char *strrstr(const char *haystack, const char *needle);
|
||||
char* strrstr(const char *haystack, const char *needle);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "string-util.h"
|
||||
#include "sysctl-util.h"
|
||||
|
||||
char *sysctl_normalize(char *s) {
|
||||
char* sysctl_normalize(char *s) {
|
||||
char *n;
|
||||
|
||||
n = strpbrk(s, "/.");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
char *sysctl_normalize(char *s);
|
||||
char* sysctl_normalize(char *s);
|
||||
int sysctl_read(const char *property, char **value);
|
||||
int sysctl_write(const char *property, const char *value);
|
||||
int sysctl_writef(const char *property, const char *format, ...) _printf_(2, 3);
|
||||
|
||||
@@ -312,7 +312,7 @@ struct timeval *timeval_store(struct timeval *tv, usec_t u) {
|
||||
return tv;
|
||||
}
|
||||
|
||||
char *format_timestamp_style(
|
||||
char* format_timestamp_style(
|
||||
char *buf,
|
||||
size_t l,
|
||||
usec_t t,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "unit-def.h"
|
||||
#include "unit-name.h"
|
||||
|
||||
char *unit_dbus_path_from_name(const char *name) {
|
||||
char* unit_dbus_path_from_name(const char *name) {
|
||||
_cleanup_free_ char *e = NULL;
|
||||
|
||||
assert(name);
|
||||
|
||||
@@ -280,7 +280,7 @@ typedef enum NotifyAccess {
|
||||
_NOTIFY_ACCESS_INVALID = -EINVAL,
|
||||
} NotifyAccess;
|
||||
|
||||
char *unit_dbus_path_from_name(const char *name);
|
||||
char* unit_dbus_path_from_name(const char *name);
|
||||
int unit_name_from_dbus_path(const char *path, char **name);
|
||||
|
||||
const char* unit_dbus_interface_from_type(UnitType t);
|
||||
|
||||
@@ -331,7 +331,7 @@ static char *do_escape(const char *f, char *t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
char *unit_name_escape(const char *f) {
|
||||
char* unit_name_escape(const char *f) {
|
||||
char *r, *t;
|
||||
|
||||
assert(f);
|
||||
|
||||
@@ -35,7 +35,7 @@ int unit_name_change_suffix(const char *n, const char *suffix, char **ret);
|
||||
int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret);
|
||||
int unit_name_build_from_type(const char *prefix, const char *instance, UnitType type, char **ret);
|
||||
|
||||
char *unit_name_escape(const char *f);
|
||||
char* unit_name_escape(const char *f);
|
||||
int unit_name_unescape(const char *f, char **ret);
|
||||
int unit_name_path_escape(const char *f, char **ret);
|
||||
int unit_name_path_unescape(const char *f, char **ret);
|
||||
|
||||
@@ -153,7 +153,7 @@ char* utf8_is_valid_n(const char *str, size_t len_bytes) {
|
||||
return (char*) str;
|
||||
}
|
||||
|
||||
char *utf8_escape_invalid(const char *str) {
|
||||
char* utf8_escape_invalid(const char *str) {
|
||||
char *p, *s;
|
||||
|
||||
assert(str);
|
||||
@@ -195,7 +195,7 @@ int utf8_char_console_width(const char *str) {
|
||||
return unichar_iswide(c) ? 2 : 1;
|
||||
}
|
||||
|
||||
char *utf8_escape_non_printable_full(const char *str, size_t console_width, bool force_ellipsis) {
|
||||
char* utf8_escape_non_printable_full(const char *str, size_t console_width, bool force_ellipsis) {
|
||||
char *p, *s, *prev_s;
|
||||
size_t n = 0; /* estimated print width */
|
||||
|
||||
@@ -359,7 +359,7 @@ size_t utf8_encode_unichar(char *out_utf8, char32_t g) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *utf16_to_utf8(const char16_t *s, size_t length /* bytes! */) {
|
||||
char* utf16_to_utf8(const char16_t *s, size_t length /* bytes! */) {
|
||||
const uint8_t *f;
|
||||
char *r, *t;
|
||||
|
||||
|
||||
@@ -29,16 +29,16 @@ int utf8_to_ascii(const char *str, char replacement_char, char **ret);
|
||||
bool utf8_is_printable_newline(const char* str, size_t length, bool allow_newline) _pure_;
|
||||
#define utf8_is_printable(str, length) utf8_is_printable_newline(str, length, true)
|
||||
|
||||
char *utf8_escape_invalid(const char *s);
|
||||
char *utf8_escape_non_printable_full(const char *str, size_t console_width, bool force_ellipsis);
|
||||
static inline char *utf8_escape_non_printable(const char *str) {
|
||||
char* utf8_escape_invalid(const char *s);
|
||||
char* utf8_escape_non_printable_full(const char *str, size_t console_width, bool force_ellipsis);
|
||||
static inline char* utf8_escape_non_printable(const char *str) {
|
||||
return utf8_escape_non_printable_full(str, SIZE_MAX, false);
|
||||
}
|
||||
|
||||
size_t utf8_encode_unichar(char *out_utf8, char32_t g);
|
||||
size_t utf16_encode_unichar(char16_t *out, char32_t c);
|
||||
|
||||
char *utf16_to_utf8(const char16_t *s, size_t length /* bytes! */);
|
||||
char* utf16_to_utf8(const char16_t *s, size_t length /* bytes! */);
|
||||
char16_t *utf8_to_utf16(const char *s, size_t length);
|
||||
|
||||
size_t char16_strlen(const char16_t *s); /* returns the number of 16-bit words in the string (not bytes!) */
|
||||
|
||||
Reference in New Issue
Block a user