char *strnrchr_m(const char *s, char c, unsigned int n);
char *strstr_m(const char *src, const char *findstr);
void strlower_m(char *s);
-void strupper_m(char *s);
+bool strupper_m(char *s);
size_t strlen_m(const char *s);
size_t strlen_m_term(const char *s);
size_t strlen_m_term_null(const char *s);
Convert a string to upper case.
**/
-void strupper_m(char *s)
+bool strupper_m(char *s)
{
size_t len;
int errno_save;
+ bool ret = false;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
}
if (!*s)
- return;
+ return true;
/* I assume that lowercased string takes the same number of bytes
* as source string even in multibyte encoding. (VIV) */
len = strlen(s) + 1;
errno_save = errno;
errno = 0;
- unix_strupper(s,len,s,len);
+ ret = unix_strupper(s,len,s,len);
/* Catch mb conversion errors that may not terminate. */
- if (errno)
+ if (errno) {
s[len-1] = '\0';
+ ret = false;
+ }
errno = errno_save;
+ return ret;
}
/**