Changeset: 384c764be3cb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=384c764be3cb Modified Files: monetdb5/mal/mal_instruction.c monetdb5/mal/mal_listing.c Branch: default Log Message:
Backed out changeset 446e3480c6d1 diffs (94 lines): diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -773,24 +773,6 @@ setVariableType(MalBlkPtr mb, const int clrVarCleanup(mb, n); } -inline void -myitoa(char *p, int i) /* convert integer into string, but this code doesn't deal with negative integers! */ -{ - char const digit[] = "0123456789"; - int shift = i; - - do { /* Find end of string */ - ++p; - shift /= 10; - } while (shift); - - *p = '\0'; - do { /* Insert digits value while going back */ - *--p = digit[i%10]; - i /= 10; - } while (i); -} - int newVariable(MalBlkPtr mb, const char *name, size_t len, malType type) { @@ -805,14 +787,7 @@ newVariable(MalBlkPtr mb, const char *na return -1; n = mb->vtop; if( name == 0 || len == 0){ - char *vname = getVarName(mb,n); - - /* Don't call snprintf because it's expensive on this common code */ - vname[0] = REFMARKER; - vname[1] = TMPMARKER; - myitoa(vname + 2, mb->vid++); - - assert(strlen(vname) < IDLENGTH); + (void) snprintf(getVarName(mb,n), IDLENGTH,"%c%c%d", REFMARKER, TMPMARKER,mb->vid++); } else { /* avoid calling strcpy_len since we're not interested in the * source length, and that may be very large */ @@ -952,16 +927,8 @@ trimMalVariables_(MalBlkPtr mb, MalStkPt /* rename the temporary variable */ mb->vid = 0; for( i =0; i< cnt; i++) - if( isTmpVar(mb,i)) { - char *vname = mb->var[i].id; - - /* Don't call snprintf because it's too expensive on this common code */ - vname[0] = REFMARKER; - vname[1] = TMPMARKER; - myitoa(vname + 2, mb->vid++); - - assert(strlen(vname) < IDLENGTH); - } + if( isTmpVar(mb,i)) + (void) snprintf(mb->var[i].id, IDLENGTH,"%c%c%d", REFMARKER, TMPMARKER,mb->vid++); GDKfree(alias); mb->vtop = cnt; diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c --- a/monetdb5/mal/mal_listing.c +++ b/monetdb5/mal/mal_listing.c @@ -70,16 +70,15 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, int showtype = 0, closequote=0; int varid = getArg(p,idx); - buf = GDKmalloc(maxlen); + buf = GDKzalloc(maxlen); if( buf == NULL) { addMalException(mb, "renderTerm:Failed to allocate"); return NULL; } - buf[0] = '\0'; // show the name when required or is used if ((flg & LIST_MAL_NAME) && !isVarConstant(mb,varid) && !isVarTypedef(mb,varid)) { nme = getVarName(mb,varid); - len += strcpy_len(buf, nme, maxlen); + len +=snprintf(buf, maxlen, "%s", nme); nameused =1; } // show the value when required or being a constant @@ -156,7 +155,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, strcat(buf + len,":"); len++; tpe = getTypeName(getVarType(mb, varid)); - len += strcpy_len(buf+len, tpe, maxlen-len); + len += snprintf(buf+len,maxlen-len,"%s",tpe); GDKfree(tpe); } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list