示例#1
0
QLStatement    *
newQLStatement(int fcm, int mode)
{
  QLStatement    *qs;
  int             x;

  qs = calloc(1, sizeof(*qs));
  if (mode == MEM_TRACKED) {
    qs->allocList = NULL;
    memAdd(qs, &x);
  } else {
    qs->allocList = malloc(16 * sizeof(void *));
    qs->allocMax = 16;
    qs->allocList[qs->allocNext++] = qs;
  }
  qs->allocMode = mode;
  qs->ft = &stmtFt;

  qs->spMax = qs->fcMax = fcm;
  qs->fClasses = (char **) qsAlloc(qs, fcm * sizeof(char *));
  qs->fClasses[0] = NULL;
  qs->spNames = (char **) qsAlloc(qs, fcm * sizeof(char *));
  qs->spNames[0] = NULL;

  return qs;
}
示例#2
0
static char* intToString(QLOperand* op) 
{
   char* str=(char*)qsAlloc(NULL,64);
   sprintf(str,"%lld",op->integerVal);
   return str;
}
示例#3
0
static char* doubleToString(QLOperand* op) 
{
   char* str=(char*)qsAlloc(NULL,64);
   sprintf(str,"%g",op->doubleVal);
   return str;
}
示例#4
0
char * qsStrDup(QLStatement *qs, char *str) {
   char *s=(char*)qsAlloc(qs,strlen(str)+1);
   strcpy(s,str);
   return s;
}