Skip to content

Commit

Permalink
string_utils: address some clang-tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelynothelix committed Aug 10, 2023
1 parent f773e72 commit 8cc5090
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ static inline int uitostr(unsigned int n, char *buf) {
ret++;
}

if (ret == 0)
if (ret == 0) {
ret = 1;
}

int pos = ret;
while (pos--) {
Expand All @@ -36,18 +37,22 @@ static inline int uitostr(unsigned int n, char *buf) {
}

static inline const char *skip_space_const(const char *src) {
if (!src)
if (!src) {
return NULL;
while (*src && isspace((unsigned char)*src))
}
while (*src && isspace((unsigned char)*src)) {
src++;
}
return src;
}

static inline char *skip_space_mut(char *src) {
if (!src)
if (!src) {
return NULL;
while (*src && isspace((unsigned char)*src))
}
while (*src && isspace((unsigned char)*src)) {
src++;
}
return src;
}

Expand Down

0 comments on commit 8cc5090

Please sign in to comment.