basic,shared: mark eligible functions with _pure_/_const_

Following the recent witch hunt done to static inline functions
I figure we should at least give the compiler some more hint
on optimizations.
This commit is contained in:
Mike Yuan
2025-05-26 20:26:58 +02:00
parent fae687ec2b
commit 180341e732
19 changed files with 88 additions and 90 deletions
+3 -3
View File
@@ -136,12 +136,12 @@ typedef enum {
IFNAME_VALID_SPECIAL = 1 << 2, /* Allow the special names "all" and "default" */
_IFNAME_VALID_ALL = IFNAME_VALID_ALTERNATIVE | IFNAME_VALID_NUMERIC | IFNAME_VALID_SPECIAL,
} IfnameValidFlags;
bool ifname_valid_char(char a);
bool ifname_valid_full(const char *p, IfnameValidFlags flags);
bool ifname_valid_char(char a) _const_;
bool ifname_valid_full(const char *p, IfnameValidFlags flags) _pure_;
static inline bool ifname_valid(const char *p) {
return ifname_valid_full(p, 0);
}
bool address_label_valid(const char *p);
bool address_label_valid(const char *p) _pure_;
int getpeercred(int fd, struct ucred *ucred);
int getpeersec(int fd, char **ret);