various: move const ptr indicator to return value
This commit is contained in:
+2
-2
@@ -12,7 +12,7 @@ static const struct af_name* lookup_af(register const char *str, register GPERF_
|
||||
#include "af-from-name.h"
|
||||
#include "af-to-name.h"
|
||||
|
||||
const char *af_to_name(int id) {
|
||||
const char* af_to_name(int id) {
|
||||
|
||||
if (id <= 0)
|
||||
return NULL;
|
||||
@@ -39,7 +39,7 @@ int af_max(void) {
|
||||
return ELEMENTSOF(af_names);
|
||||
}
|
||||
|
||||
const char *af_to_ipv4_ipv6(int id) {
|
||||
const char* af_to_ipv4_ipv6(int id) {
|
||||
/* Pretty often we want to map the address family to the typically used protocol name for IPv4 +
|
||||
* IPv6. Let's add special helpers for that. */
|
||||
return id == AF_INET ? "ipv4" :
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "string-util.h"
|
||||
|
||||
const char *af_to_name(int id);
|
||||
const char* af_to_name(int id);
|
||||
int af_from_name(const char *name);
|
||||
|
||||
static inline const char* af_to_name_short(int id) {
|
||||
|
||||
@@ -242,5 +242,5 @@ Architecture uname_architecture(void);
|
||||
# error "Please register your architecture here!"
|
||||
#endif
|
||||
|
||||
const char *architecture_to_string(Architecture a) _const_;
|
||||
const char* architecture_to_string(Architecture a) _const_;
|
||||
Architecture architecture_from_string(const char *s) _pure_;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
const char *arphrd_to_name(int id);
|
||||
const char* arphrd_to_name(int id);
|
||||
int arphrd_from_name(const char *name);
|
||||
|
||||
size_t arphrd_to_hw_addr_len(uint16_t arphrd);
|
||||
|
||||
@@ -18,7 +18,7 @@ static const struct capability_name* lookup_capability(register const char *str,
|
||||
#include "cap-from-name.h"
|
||||
#include "cap-to-name.h"
|
||||
|
||||
const char *capability_to_name(int id) {
|
||||
const char* capability_to_name(int id) {
|
||||
if (id < 0)
|
||||
return NULL;
|
||||
if (id >= capability_list_length())
|
||||
@@ -27,7 +27,7 @@ const char *capability_to_name(int id) {
|
||||
return capability_names[id];
|
||||
}
|
||||
|
||||
const char *capability_to_string(int id, char buf[static CAPABILITY_TO_STRING_MAX]) {
|
||||
const char* capability_to_string(int id, char buf[static CAPABILITY_TO_STRING_MAX]) {
|
||||
const char *p;
|
||||
|
||||
if (id < 0)
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* "0x", two bytes for the hex value, and one trailing NUL byte. */
|
||||
#define CAPABILITY_TO_STRING_MAX (2 + 2 + 1)
|
||||
|
||||
const char *capability_to_name(int id);
|
||||
const char *capability_to_string(int id, char buf[static CAPABILITY_TO_STRING_MAX]);
|
||||
const char* capability_to_name(int id);
|
||||
const char* capability_to_string(int id, char buf[static CAPABILITY_TO_STRING_MAX]);
|
||||
#define CAPABILITY_TO_STRING(id) capability_to_string(id, (char[CAPABILITY_TO_STRING_MAX]) {})
|
||||
|
||||
int capability_from_name(const char *name);
|
||||
|
||||
@@ -21,5 +21,5 @@ typedef enum ConfidentialVirtualization {
|
||||
|
||||
ConfidentialVirtualization detect_confidential_virtualization(void);
|
||||
|
||||
const char *confidential_virtualization_to_string(ConfidentialVirtualization v) _const_;
|
||||
const char* confidential_virtualization_to_string(ConfidentialVirtualization v) _const_;
|
||||
ConfidentialVirtualization confidential_virtualization_from_string(const char *s) _pure_;
|
||||
|
||||
@@ -12,7 +12,7 @@ static const struct errno_name* lookup_errno(register const char *str,
|
||||
#include "errno-from-name.h"
|
||||
#include "errno-to-name.h"
|
||||
|
||||
const char *errno_to_name(int id) {
|
||||
const char* errno_to_name(int id) {
|
||||
|
||||
if (id < 0)
|
||||
id = -id;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#define ERRNO_MAX 4095
|
||||
|
||||
const char *errno_to_name(int id);
|
||||
const char* errno_to_name(int id);
|
||||
int errno_from_name(const char *name);
|
||||
static inline bool errno_is_valid(int n) {
|
||||
return n > 0 && n <= ERRNO_MAX;
|
||||
|
||||
+1
-1
@@ -1091,7 +1091,7 @@ int fds_are_same_mount(int fd1, int fd2) {
|
||||
return statx_mount_same(&st1.nsx, &st2.nsx);
|
||||
}
|
||||
|
||||
const char *accmode_to_string(int flags) {
|
||||
const char* accmode_to_string(int flags) {
|
||||
switch (flags & O_ACCMODE) {
|
||||
case O_RDONLY:
|
||||
return "ro";
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ char *format_proc_pid_fd_path(char buf[static PROC_PID_FD_PATH_MAX], pid_t pid,
|
||||
|
||||
int proc_fd_enoent_errno(void);
|
||||
|
||||
const char *accmode_to_string(int flags);
|
||||
const char* accmode_to_string(int flags);
|
||||
|
||||
/* Like ASSERT_PTR, but for fds */
|
||||
#define ASSERT_FD(fd) \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "filesystems-gperf.h"
|
||||
#include "stat-util.h"
|
||||
|
||||
const char *fs_type_to_string(statfs_f_type_t magic) {
|
||||
const char* fs_type_to_string(statfs_f_type_t magic) {
|
||||
|
||||
switch (magic) {
|
||||
#include "filesystem-switch-case.h"
|
||||
|
||||
@@ -34,7 +34,7 @@ extern const FilesystemSet filesystem_sets[];
|
||||
|
||||
const FilesystemSet *filesystem_set_find(const char *name);
|
||||
|
||||
const char *fs_type_to_string(statfs_f_type_t magic);
|
||||
const char* fs_type_to_string(statfs_f_type_t magic);
|
||||
int fs_type_from_string(const char *name, const statfs_f_type_t **ret);
|
||||
bool fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ bool emoji_enabled(void) {
|
||||
return cached_emoji_enabled;
|
||||
}
|
||||
|
||||
const char *special_glyph_full(SpecialGlyph code, bool force_utf) {
|
||||
const char* special_glyph_full(SpecialGlyph code, bool force_utf) {
|
||||
|
||||
/* A list of a number of interesting unicode glyphs we can use to decorate our output. It's probably wise to be
|
||||
* conservative here, and primarily stick to the glyphs defined in the eurlatgr font, so that display still
|
||||
|
||||
@@ -61,16 +61,16 @@ typedef enum SpecialGlyph {
|
||||
|
||||
bool emoji_enabled(void);
|
||||
|
||||
const char *special_glyph_full(SpecialGlyph code, bool force_utf) _const_;
|
||||
const char* special_glyph_full(SpecialGlyph code, bool force_utf) _const_;
|
||||
|
||||
static inline const char *special_glyph(SpecialGlyph code) {
|
||||
static inline const char* special_glyph(SpecialGlyph code) {
|
||||
return special_glyph_full(code, false);
|
||||
}
|
||||
|
||||
static inline const char *special_glyph_check_mark(bool b) {
|
||||
static inline const char* special_glyph_check_mark(bool b) {
|
||||
return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : special_glyph(SPECIAL_GLYPH_CROSS_MARK);
|
||||
}
|
||||
|
||||
static inline const char *special_glyph_check_mark_space(bool b) {
|
||||
static inline const char* special_glyph_check_mark_space(bool b) {
|
||||
return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : " ";
|
||||
}
|
||||
|
||||
+1
-1
@@ -1741,7 +1741,7 @@ void log_setup(void) {
|
||||
log_show_color(true);
|
||||
}
|
||||
|
||||
const char *_log_set_prefix(const char *prefix, bool force) {
|
||||
const char* _log_set_prefix(const char *prefix, bool force) {
|
||||
const char *old = log_prefix;
|
||||
|
||||
if (prefix || force)
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ static inline void clear_log_syntax_callback(dummy_t *dummy) {
|
||||
set_log_syntax_callback(/* cb= */ NULL, /* userdata= */ NULL);
|
||||
}
|
||||
|
||||
const char *log_target_to_string(LogTarget target) _const_;
|
||||
const char* log_target_to_string(LogTarget target) _const_;
|
||||
LogTarget log_target_from_string(const char *s) _pure_;
|
||||
void log_set_target(LogTarget target);
|
||||
void log_set_target_and_open(LogTarget target);
|
||||
@@ -432,8 +432,8 @@ typedef struct LogRateLimit {
|
||||
#define log_ratelimit_error_errno(error, ...) log_ratelimit_full_errno(LOG_ERR, error, __VA_ARGS__)
|
||||
#define log_ratelimit_emergency_errno(error, ...) log_ratelimit_full_errno(log_emergency_level(), error, __VA_ARGS__)
|
||||
|
||||
const char *_log_set_prefix(const char *prefix, bool force);
|
||||
static inline const char *_log_unset_prefixp(const char **p) {
|
||||
const char* _log_set_prefix(const char *prefix, bool force);
|
||||
static inline const char* _log_unset_prefixp(const char **p) {
|
||||
assert(p);
|
||||
_log_set_prefix(*p, true);
|
||||
return NULL;
|
||||
|
||||
@@ -647,7 +647,7 @@ int mount_nofollow(
|
||||
return mount_fd(source, fd, filesystemtype, mountflags, data);
|
||||
}
|
||||
|
||||
const char *mount_propagation_flag_to_string(unsigned long flags) {
|
||||
const char* mount_propagation_flag_to_string(unsigned long flags) {
|
||||
|
||||
switch (flags & (MS_SHARED|MS_SLAVE|MS_PRIVATE)) {
|
||||
case 0:
|
||||
|
||||
@@ -70,7 +70,7 @@ int mount_nofollow(
|
||||
unsigned long mountflags,
|
||||
const void *data);
|
||||
|
||||
const char *mount_propagation_flag_to_string(unsigned long flags);
|
||||
const char* mount_propagation_flag_to_string(unsigned long flags);
|
||||
int mount_propagation_flag_from_string(const char *name, unsigned long *ret);
|
||||
bool mount_propagation_flag_is_valid(unsigned long flag);
|
||||
|
||||
|
||||
+1
-1
@@ -476,7 +476,7 @@ int os_release_support_ended(const char *support_end, bool quiet, usec_t *ret_eo
|
||||
return DIV_ROUND_UP(now(CLOCK_REALTIME), USEC_PER_SEC) > (usec_t) eol;
|
||||
}
|
||||
|
||||
const char *os_release_pretty_name(const char *pretty_name, const char *name) {
|
||||
const char* os_release_pretty_name(const char *pretty_name, const char *name) {
|
||||
/* Distills a "pretty" name to show from os-release data. First argument is supposed to be the
|
||||
* PRETTY_NAME= field, the second one the NAME= field. This function is trivial, of course, and
|
||||
* exists mostly to ensure we use the same logic wherever possible. */
|
||||
|
||||
+1
-1
@@ -57,4 +57,4 @@ int load_os_release_pairs_with_prefix(const char *root, const char *prefix, char
|
||||
|
||||
int os_release_support_ended(const char *support_end, bool quiet, usec_t *ret_eol);
|
||||
|
||||
const char *os_release_pretty_name(const char *pretty_name, const char *name);
|
||||
const char* os_release_pretty_name(const char *pretty_name, const char *name);
|
||||
|
||||
@@ -203,7 +203,7 @@ bool dot_or_dot_dot(const char *path);
|
||||
|
||||
bool path_implies_directory(const char *path);
|
||||
|
||||
static inline const char *skip_dev_prefix(const char *p) {
|
||||
static inline const char* skip_dev_prefix(const char *p) {
|
||||
const char *e;
|
||||
|
||||
/* Drop any /dev prefix if there is any */
|
||||
|
||||
@@ -113,12 +113,12 @@ bool oom_score_adjust_is_valid(int oa);
|
||||
#define OPINIONATED_PERSONALITY_MASK 0xFFUL
|
||||
|
||||
unsigned long personality_from_string(const char *p);
|
||||
const char *personality_to_string(unsigned long);
|
||||
const char* personality_to_string(unsigned long);
|
||||
|
||||
int safe_personality(unsigned long p);
|
||||
int opinionated_personality(unsigned long *ret);
|
||||
|
||||
const char *sigchld_code_to_string(int i) _const_;
|
||||
const char* sigchld_code_to_string(int i) _const_;
|
||||
int sigchld_code_from_string(const char *s) _pure_;
|
||||
|
||||
int sched_policy_to_string_alloc(int i, char **s);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "macro.h"
|
||||
#include "missing_resource.h"
|
||||
|
||||
const char *rlimit_to_string(int i) _const_;
|
||||
const char* rlimit_to_string(int i) _const_;
|
||||
int rlimit_from_string(const char *s) _pure_;
|
||||
int rlimit_from_string_harder(const char *s) _pure_;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef enum RuntimeScope {
|
||||
_RUNTIME_SCOPE_INVALID = -EINVAL,
|
||||
} RuntimeScope;
|
||||
|
||||
const char *runtime_scope_to_string(RuntimeScope scope) _const_;
|
||||
const char* runtime_scope_to_string(RuntimeScope scope) _const_;
|
||||
RuntimeScope runtime_scope_from_string(const char *s) _const_;
|
||||
|
||||
const char *runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_;
|
||||
const char* runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_;
|
||||
|
||||
@@ -151,7 +151,7 @@ static const char *const static_signal_table[] = {
|
||||
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(static_signal, int);
|
||||
|
||||
const char *signal_to_string(int signo) {
|
||||
const char* signal_to_string(int signo) {
|
||||
static thread_local char buf[STRLEN("RTMIN+") + DECIMAL_STR_MAX(int)];
|
||||
const char *name;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ int sigset_add_many_internal(sigset_t *ss, ...);
|
||||
int sigprocmask_many_internal(int how, sigset_t *old, ...);
|
||||
#define sigprocmask_many(...) sigprocmask_many_internal(__VA_ARGS__, -1)
|
||||
|
||||
const char *signal_to_string(int i) _const_;
|
||||
const char* signal_to_string(int i) _const_;
|
||||
int signal_from_string(const char *s) _pure_;
|
||||
|
||||
void nop_signal_handler(int sig);
|
||||
|
||||
@@ -15,7 +15,7 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
|
||||
|
||||
/* For basic lookup tables with strictly enumerated entries */
|
||||
#define _DEFINE_STRING_TABLE_LOOKUP_TO_STRING(name,type,scope) \
|
||||
scope const char *name##_to_string(type i) { \
|
||||
scope const char* name##_to_string(type i) { \
|
||||
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
|
||||
return NULL; \
|
||||
return name##_table[i]; \
|
||||
|
||||
@@ -49,7 +49,7 @@ static inline const char* strnull(const char *s) {
|
||||
return s ?: "(null)";
|
||||
}
|
||||
|
||||
static inline const char *strna(const char *s) {
|
||||
static inline const char* strna(const char *s) {
|
||||
return s ?: "n/a";
|
||||
}
|
||||
|
||||
@@ -81,11 +81,11 @@ static inline const char* enabled_disabled(bool b) {
|
||||
(typeof(p)) (isempty(_p) ? NULL : _p); \
|
||||
})
|
||||
|
||||
static inline const char *empty_to_na(const char *p) {
|
||||
static inline const char* empty_to_na(const char *p) {
|
||||
return isempty(p) ? "n/a" : p;
|
||||
}
|
||||
|
||||
static inline const char *empty_to_dash(const char *str) {
|
||||
static inline const char* empty_to_dash(const char *str) {
|
||||
return isempty(str) ? "-" : str;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ static inline bool empty_or_dash(const char *str) {
|
||||
(str[0] == '-' && str[1] == 0);
|
||||
}
|
||||
|
||||
static inline const char *empty_or_dash_to_null(const char *p) {
|
||||
static inline const char* empty_or_dash_to_null(const char *p) {
|
||||
return empty_or_dash(p) ? NULL : p;
|
||||
}
|
||||
#define empty_or_dash_to_null(p) \
|
||||
|
||||
@@ -790,7 +790,7 @@ bool tty_is_vc_resolve(const char *tty) {
|
||||
return tty_is_vc(tty);
|
||||
}
|
||||
|
||||
const char *default_term_for_tty(const char *tty) {
|
||||
const char* default_term_for_tty(const char *tty) {
|
||||
return tty && tty_is_vc_resolve(tty) ? "linux" : "vt220";
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ bool tty_is_vc(const char *tty);
|
||||
bool tty_is_vc_resolve(const char *tty);
|
||||
bool tty_is_console(const char *tty) _pure_;
|
||||
int vtnr_from_tty(const char *tty);
|
||||
const char *default_term_for_tty(const char *tty);
|
||||
const char* default_term_for_tty(const char *tty);
|
||||
|
||||
int make_console_stdio(void);
|
||||
|
||||
@@ -198,15 +198,15 @@ static inline bool colors_enabled(void) {
|
||||
} \
|
||||
}
|
||||
|
||||
static inline const char *ansi_underline(void) {
|
||||
static inline const char* ansi_underline(void) {
|
||||
return underline_enabled() ? ANSI_UNDERLINE : "";
|
||||
}
|
||||
|
||||
static inline const char *ansi_add_underline(void) {
|
||||
static inline const char* ansi_add_underline(void) {
|
||||
return underline_enabled() ? ANSI_ADD_UNDERLINE : "";
|
||||
}
|
||||
|
||||
static inline const char *ansi_add_underline_grey(void) {
|
||||
static inline const char* ansi_add_underline_grey(void) {
|
||||
return underline_enabled() ?
|
||||
(colors_enabled() ? ANSI_ADD_UNDERLINE_GREY : ANSI_ADD_UNDERLINE) : "";
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ const char* unit_dbus_interface_from_type(UnitType t) {
|
||||
return table[t];
|
||||
}
|
||||
|
||||
const char *unit_dbus_interface_from_name(const char *name) {
|
||||
const char* unit_dbus_interface_from_name(const char *name) {
|
||||
UnitType t;
|
||||
|
||||
t = unit_name_to_type(name);
|
||||
|
||||
@@ -284,24 +284,24 @@ 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);
|
||||
const char *unit_dbus_interface_from_name(const char *name);
|
||||
const char* unit_dbus_interface_from_name(const char *name);
|
||||
|
||||
const char *unit_type_to_string(UnitType i) _const_;
|
||||
const char* unit_type_to_string(UnitType i) _const_;
|
||||
UnitType unit_type_from_string(const char *s) _pure_;
|
||||
|
||||
const char* unit_type_to_capitalized_string(UnitType t);
|
||||
|
||||
const char *unit_load_state_to_string(UnitLoadState i) _const_;
|
||||
const char* unit_load_state_to_string(UnitLoadState i) _const_;
|
||||
UnitLoadState unit_load_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char *unit_active_state_to_string(UnitActiveState i) _const_;
|
||||
const char* unit_active_state_to_string(UnitActiveState i) _const_;
|
||||
UnitActiveState unit_active_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char *freezer_state_to_string(FreezerState i) _const_;
|
||||
const char* freezer_state_to_string(FreezerState i) _const_;
|
||||
FreezerState freezer_state_from_string(const char *s) _pure_;
|
||||
FreezerState freezer_state_finish(FreezerState i) _const_;
|
||||
|
||||
const char *unit_marker_to_string(UnitMarker m) _const_;
|
||||
const char* unit_marker_to_string(UnitMarker m) _const_;
|
||||
UnitMarker unit_marker_from_string(const char *s) _pure_;
|
||||
|
||||
const char* automount_state_to_string(AutomountState i) _const_;
|
||||
@@ -334,10 +334,10 @@ SwapState swap_state_from_string(const char *s) _pure_;
|
||||
const char* target_state_to_string(TargetState i) _const_;
|
||||
TargetState target_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char *timer_state_to_string(TimerState i) _const_;
|
||||
const char* timer_state_to_string(TimerState i) _const_;
|
||||
TimerState timer_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char *unit_dependency_to_string(UnitDependency i) _const_;
|
||||
const char* unit_dependency_to_string(UnitDependency i) _const_;
|
||||
UnitDependency unit_dependency_from_string(const char *s) _pure_;
|
||||
|
||||
const char* notify_access_to_string(NotifyAccess i) _const_;
|
||||
|
||||
+1
-1
@@ -65,6 +65,6 @@ Virtualization detect_virtualization(void);
|
||||
int running_in_userns(void);
|
||||
int running_in_chroot(void);
|
||||
|
||||
const char *virtualization_to_string(Virtualization v) _const_;
|
||||
const char* virtualization_to_string(Virtualization v) _const_;
|
||||
Virtualization virtualization_from_string(const char *s) _pure_;
|
||||
bool has_cpu_with_flag(const char *flag);
|
||||
|
||||
Reference in New Issue
Block a user