Let winbind depend directly on libnet rather than through the ejs bindings.
[samba.git] / source4 / scripting / ejs / smbcalls_string.c
index ab5aecd84757f44278350941d810d51889edb1aa..541303ff2d0ecf3d9b920b9f4f1eb68c1d4abe8c 100644 (file)
@@ -8,7 +8,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -17,8 +17,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -239,7 +238,7 @@ static int ejs_join(MprVarHandle eid, int argc, struct MprVar **argv)
                goto failed;
        }
        for (i=1;list[i];i++) {
-               ret = talloc_asprintf_append(ret, "%s%s", separator, list[i]);
+               ret = talloc_asprintf_append_buffer(ret, "%s%s", separator, list[i]);
                if (ret == NULL) {
                        goto failed;
                }
@@ -276,7 +275,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
        ret = talloc_strdup(tmp_ctx, "");
 
        /* avoid all the format string warnings */
-       _asprintf_append = (_asprintf_append_t)talloc_asprintf_append;
+       _asprintf_append = (_asprintf_append_t)talloc_asprintf_append_buffer;
 
        /*
          hackity hack ...
@@ -285,7 +284,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
                char *fmt2;
                int len, len_count=0;
                char *tstr;
-               ret = talloc_asprintf_append(ret, "%*.*s", 
+               ret = talloc_asprintf_append_buffer(ret, "%*.*s", 
                                             (int)(p-format), (int)(p-format), 
                                             format);
                if (ret == NULL) goto failed;
@@ -300,7 +299,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
                        tstr--;
                }
                if (strcmp(tstr, "%") == 0) {
-                       ret = talloc_asprintf_append(ret, "%%");
+                       ret = talloc_asprintf_append_buffer(ret, "%%");
                        if (ret == NULL) {
                                goto failed;
                        }
@@ -373,7 +372,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
                format += len+1;
        }
 
-       ret = talloc_asprintf_append(ret, "%s", format);
+       ret = talloc_asprintf_append_buffer(ret, "%s", format);
        mpr_Return(eid, mprString(ret));
        talloc_free(tmp_ctx);
        return 0;          
@@ -438,7 +437,7 @@ static int ejs_encodeURIComponent(MprVarHandle eid, int argc, char **argv)
                if (!isalnum(s[i])) count++;
        }
        
-       ret = talloc_size(mprMemCtx(), i + count*2 + 1);
+       ret = talloc_array(mprMemCtx(), char, i + count*2 + 1);
        if (ret == NULL) {
                return -1;
        }
@@ -471,7 +470,7 @@ static int ejs_decodeURIComponent(MprVarHandle eid, int argc, char **argv)
        
        s = argv[0];
 
-       ret = talloc_size(mprMemCtx(), strlen(s) + 1);
+       ret = talloc_array(mprMemCtx(), char, strlen(s) + 1);
        if (ret == NULL) {
                return -1;
        }