summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-08-08 12:16:40 -0700
committerJeremy Allison <jra@samba.org>2012-08-09 09:47:35 -0700
commit9fcc6f27fb2cf8cf5c30b701cb6788fc8f70cf82 (patch)
tree68998f6bfdf92939f26690901fc9b7fb34a1bf4a
parentaf3e529c18dae94d10b617eb8377e2ab64d34982 (diff)
downloadsamba-9fcc6f27fb2cf8cf5c30b701cb6788fc8f70cf82.tar.gz
samba-9fcc6f27fb2cf8cf5c30b701cb6788fc8f70cf82.tar.bz2
samba-9fcc6f27fb2cf8cf5c30b701cb6788fc8f70cf82.zip
Change strupper_m() to return a value.
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/util_str.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ebb76effac..bdb20bf8ff 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -702,7 +702,7 @@ char *strrchr_m(const char *s, char c);
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);
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index f6d9f3425f..f97cd3cc25 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -547,10 +547,11 @@ _PUBLIC_ void strupper_m(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
@@ -563,18 +564,21 @@ void strupper_m(char *s)
}
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;
}
/**