Update of /cvsroot/monetdb/MonetDB5/src/modules/atoms
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4186/src/modules/atoms

Modified Files:
        str.mx 
Log Message:
propagated changes of Friday Nov 30 2007 - Monday Dec 03 2007
from the MonetDB_5-2 branch to the development trunk


Index: str.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/str.mx,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- str.mx      4 Oct 2007 10:37:14 -0000       1.68
+++ str.mx      3 Dec 2007 08:31:07 -0000       1.69
@@ -2467,19 +2467,22 @@
 }
 
 str
-STRrepeat(str *ret, str *s, int *c){
+STRrepeat(str *ret, str *s, int *c)
+{
        str t;
        int i;
        size_t l;
 
-       if( *c < 0 || strcmp(*s,str_nil)==0 )
-               *ret= GDKstrdup(str_nil);
-       else {
-               l= strlen(*s);
-               t= *ret = GDKmalloc( *c * l +1);
+       if (*c < 0 || strcmp(*s, str_nil) == 0) {
+               *ret = GDKstrdup(str_nil);
+       } else {
+               l = strlen(*s);
+               t = *ret = GDKmalloc( *c * l + 1);
+
+               if (!t)
+                       throw(MAL, "str.repeat", "Allocation failed");
                *t = 0;
-               
-               for(i= *c; i>0; i--,t+= l) 
+               for(i = *c; i>0; i--, t += l) 
                        strcat(t, *s);
        }
        return MAL_SUCCEED;


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to