Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

outputext* outputext_new ( char *  contype,
char *  vartype 
)

Allocate a new output extension struct.

Parameters:
contype Constant resource type.
vartype Variable resource type.
Returns:
Pointer to the new output extension struct or NULL on error.

Definition at line 911 of file data.c.

References outputext_t::con_typeid, outputext_t::connum, outputext_t::list, resourcetype_t::resnum, restype_findid(), outputext_t::var_typeid, and outputext_t::varnum.

{
      int n,m;
      int conid, varid;
      int connum, varnum;
      outputext *dest;

      assert(contype!=NULL);
      assert(vartype!=NULL);

      conid=restype_findid(contype);
      if(conid==INT_MIN) return(NULL);

      connum=dat_restype[conid].resnum;
      assert(connum>0);

      varid=restype_findid(vartype);
      if(varid==INT_MIN) return(NULL);

      varnum=dat_restype[varid].resnum;
      assert(varnum>0);

      dest=malloc(sizeof(*dest));
      if(dest==NULL) return(NULL);

      dest->con_typeid=conid;
      dest->connum=connum;

      dest->var_typeid=varid;
      dest->varnum=varnum;

      dest->list=malloc(sizeof(*dest->list)*varnum);
      if(dest->list==NULL) {
            free(dest);
            return(NULL);
      }

      for(n=0;n<varnum;n++) {
            dest->list[n]=malloc(sizeof(*dest->list[n])*connum);
            if(dest->list[n]==NULL) {
                  for(m=0;m<n;m++) free(dest->list[m]);
                  free(dest->list);
                  free(dest);
                  return(NULL);
            }
            for(m=0;m<connum;m++) {
                  dest->list[n][m]=NULL;
            }
      }

      return(dest);
}


Generated by  Doxygen 1.6.0   Back to index