Use push_ucs2_allocate(), rather than convert_string_allocate() directly.
authorAndrew Bartlett <abartlet@samba.org>
Sun, 27 Jul 2003 02:40:06 +0000 (02:40 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 27 Jul 2003 02:40:06 +0000 (02:40 +0000)
Remove strdup_upper/strdup_lower from their old file, now that they have
been moved to charcnv.c

Note that string_replace assumes that s is a pstring.  (doco change only)

Andrew Bartlett

source/lib/charcnv.c
source/lib/util_str.c

index 8896f0b886bf95eb0d677f674a86aa18f9df5d62..ca5e378970cb59d7dc8a45e70c435f58bad211ed 100644 (file)
@@ -343,16 +343,14 @@ char *strdup_upper(const char *s)
        smb_ucs2_t *buffer;
        char *out_buffer;
        
-       size = convert_string_allocate(CH_UNIX, CH_UCS2, s, strlen(s)+1,
-                                      (void **) &buffer);
+       size = push_ucs2_allocate(&buffer, s);
        if (size == -1) {
                return NULL;
        }
 
        strupper_w(buffer);
        
-       size = convert_string_allocate(CH_UCS2, CH_UNIX, buffer, size, 
-                                      (void **) &out_buffer);
+       size = pull_ucs2_allocate(&out_buffer, buffer);
        SAFE_FREE(buffer);
 
        if (size == -1) {
@@ -391,16 +389,14 @@ char *strdup_lower(const char *s)
        smb_ucs2_t *buffer;
        char *out_buffer;
        
-       size = convert_string_allocate(CH_UNIX, CH_UCS2, s, strlen(s),
-                                      (void **) &buffer);
+       size = push_ucs2_allocate(&buffer, s);
        if (size == -1) {
                return NULL;
        }
 
        strlower_w(buffer);
        
-       size = convert_string_allocate(CH_UCS2, CH_UNIX, buffer, size, 
-                                      (void **) &out_buffer);
+       size = pull_ucs2_allocate(&out_buffer, buffer);
        SAFE_FREE(buffer);
 
        if (size == -1) {
index bcdcb90e89312d37b4ed73151f8df07c36235dda..7569a39e6acf40b8911322886a70fec5f186546e 100644 (file)
@@ -208,17 +208,15 @@ int StrCaseCmp(const char *s, const char *t)
                        return +1;
        }
 
-       size = convert_string_allocate(CH_UNIX, CH_UCS2, s, strlen(s),
-                                      (void **) &buffer_s);
-       if (size == -1) {
+       size = push_ucs2_allocate(&buffer_s, s);
+       if (size == (size_t)-1) {
                return strcmp(s, t); 
                /* Not quite the right answer, but finding the right one
                   under this failure case is expensive, and it's pretty close */
        }
        
-       size = convert_string_allocate(CH_UNIX, CH_UCS2, t, strlen(t),
-                                      (void **) &buffer_t);
-       if (size == -1) {
+       size = push_ucs2_allocate(&buffer_t, t);
+       if (size == (size_t)-1) {
                SAFE_FREE(buffer_s);
                return strcmp(s, t); 
                /* Not quite the right answer, but finding the right one
@@ -364,7 +362,7 @@ BOOL strisnormal(const char *s)
  NOTE: oldc and newc must be 7 bit characters
 **/
 
-void string_replace(char *s,char oldc,char newc)
+void string_replace(pstring s,char oldc,char newc)
 {
        push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE);
        string_replace_w(tmpbuf, UCS2_CHAR(oldc), UCS2_CHAR(newc));
@@ -1168,21 +1166,6 @@ void strlower_m(char *s)
        unix_strlower(s,strlen(s)+1,s,strlen(s)+1);     
 }
 
-/**
- Duplicate convert a string to lower case.
-**/
-
-char *strdup_lower(const char *s)
-{
-       char *t = strdup(s);
-       if (t == NULL) {
-               DEBUG(0, ("strdup_lower: Out of memory!\n"));
-               return NULL;
-       }
-       strlower_m(t);
-       return t;
-}
-
 /**
  Convert a string to upper case.
 **/
@@ -1207,21 +1190,6 @@ void strupper_m(char *s)
        unix_strupper(s,strlen(s)+1,s,strlen(s)+1);     
 }
 
-/**
- Convert a string to upper case.
-**/
-
-char *strdup_upper(const char *s)
-{
-       char *t = strdup(s);
-       if (t == NULL) {
-               DEBUG(0, ("strdup_upper: Out of memory!\n"));
-               return NULL;
-       }
-       strupper_m(t);
-       return t;
-}
-
 /**
  Return a RFC2254 binary string representation of a buffer.
  Used in LDAP filters.