xdebug_path_info *xdebug_path_info_ctor(void) { xdebug_path_info *tmp; tmp = xdmalloc(sizeof(xdebug_path_info)); tmp->paths_count = 0; tmp->paths_size = 0; tmp->paths = NULL; tmp->path_hash = NULL; return tmp; }
xdebug_xml_node *xdebug_xml_node_init_ex(char *tag, int free_tag) { xdebug_xml_node *xml = (xdebug_xml_node*) xdmalloc(sizeof (xdebug_xml_node)); xml->tag = tag; xml->text = nullptr; xml->child = nullptr; xml->attribute = nullptr; xml->next = nullptr; xml->free_tag = free_tag; return xml; }
xdebug_coverage_file *xdebug_coverage_file_ctor(char *filename) { xdebug_coverage_file *file; file = xdmalloc(sizeof(xdebug_coverage_file)); file->name = xdstrdup(filename); file->lines = xdebug_hash_alloc(128, xdebug_coverage_line_dtor); file->functions = xdebug_hash_alloc(128, xdebug_coverage_function_dtor); file->has_branch_info = 0; return file; }
/** * Duplicate zend_strndup in core to avoid mismatches * in C-runtime libraries when xdebug and core are built * with different run-time libraries. */ char *xdebug_strndup(const char *s, int length) { char *p; p = (char *) xdmalloc(length + 1); if (p == NULL) { return p; } if (length) { memcpy(p, s, length); } p[length] = 0; return p; }
void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int free_text, int encode) { xdebug_xml_text_node *node = xdmalloc(sizeof (xdebug_xml_text_node)); node->free_value = free_text; node->encode = encode; if (xml->text) { xdebug_xml_text_node_dtor(xml->text); } node->text = text; xml->text = node; if (!encode && strstr(node->text, "]]>")) { node->encode = 1; } }
char *xdebug_raw_url_encode(char const *s, int len, int *new_length, int skip_slash) { register int x, y; unsigned char *str; str = (unsigned char *) xdmalloc(3 * len + 1); for (x = 0, y = 0; len--; x++, y++) { str[y] = (unsigned char) s[x]; if ((str[y] < '0' && str[y] != '-' && str[y] != '.' && (str[y] != '/' || !skip_slash)) || (str[y] < 'A' && str[y] > '9' && str[y] != ':') || (str[y] > 'Z' && str[y] < 'a' && str[y] != '_' && (str[y] != '\\' || !skip_slash)) || (str[y] > 'z')) { str[y++] = '%'; str[y++] = hexchars[(unsigned char) s[x] >> 4]; str[y] = hexchars[(unsigned char) s[x] & 15]; } }
void xdebug_xml_add_attribute_ex(xdebug_xml_node* xml, char *attribute, char *value, int free_name, int free_value) { xdebug_xml_attribute *attr = xdmalloc(sizeof (xdebug_xml_attribute)); xdebug_xml_attribute **ptr; /* Init structure */ attr->name = attribute; attr->value = value; attr->next = NULL; attr->free_name = free_name; attr->free_value = free_value; /* Find last attribute in node */ ptr = &xml->attribute; while (*ptr != NULL) { ptr = &(*ptr)->next; } *ptr = attr; }
void xdebug_xml_add_attribute_exl(xdebug_xml_node* xml, char* attribute, size_t attribute_len, char* value, size_t value_len, int free_name, int free_value) { auto attr = (xdebug_xml_attribute*)xdmalloc(sizeof(xdebug_xml_attribute)); xdebug_xml_attribute** ptr; /* Init structure */ attr->name = attribute; attr->value = value; attr->name_len = attribute_len; attr->value_len = value_len; attr->next = nullptr; attr->free_name = free_name; attr->free_value = free_value; /* Find last attribute in node */ ptr = &xml->attribute; while (*ptr != nullptr) { ptr = &(*ptr)->next; } *ptr = attr; }
cst_track *mlpg(const cst_track *param_track, cst_cg_db *cg_db) { /* Generate an (mcep) track using Maximum Likelihood Parameter Generation */ MLPGPARA param = NODATA; cst_track *out; int dim, dim_st; // float like; int i,j; int nframes; PStreamChol pst; nframes = param_track->num_frames; dim = (param_track->num_channels/2)-1; dim_st = dim/2; /* dim2 in original code */ out = new_track(); cst_track_resize(out,nframes,dim_st+1); param = xmlpgpara_init(dim,dim_st,nframes,nframes); // mixture-index sequence param->clsidxv = xlvalloc(nframes); for (i=0; i<nframes; i++) param->clsidxv->data[i] = i; // initial static feature sequence param->stm = xdmalloc(nframes,dim_st); for (i=0; i<nframes; i++) { for (j=0; j<dim_st; j++) param->stm->data[i][j] = param_track->frames[i][(j+1)*2]; } /* Load cluster means */ for (i=0; i<nframes; i++) for (j=0; j<dim_st; j++) param->mean->data[i][j] = param_track->frames[i][(j+1)*2]; /* GMM parameters diagonal covariance */ InitPStreamChol(&pst, cg_db->dynwin, cg_db->dynwinsize, dim_st-1, nframes); param->pdf = xdmalloc(nframes,dim*2); param->cov = xdmalloc(nframes,dim); for (i=0; i<nframes; i++) for (j=0; j<dim; j++) param->cov->data[i][j] = param_track->frames[i][(j+1)*2+1] * param_track->frames[i][(j+1)*2+1]; param->detvec = xget_detvec_diamat2inv(param->cov); /* global variance parameters */ /* TBD get_gv_mlpgpara(param, vmfile, vvfile, dim2, msg_flag); */ get_dltmat(param->stm, &pst.dw, 1, param->dltm); //like = get_like_pdfseq_vit(dim, dim_st, nframes, nframes, param, param_track->frames, XTRUE); /* vlike = get_like_gv(dim2, dnum, param); */ mlgparaChol(param->pdf, &pst, param->stm); /* Put the answer back into the output track */ for (i=0; i<nframes; i++) { out->times[i] = param_track->times[i]; out->frames[i][0] = param_track->frames[i][0]; /* F0 */ for (j=0; j<dim_st; j++) out->frames[i][j+1] = param->stm->data[i][j]; } // memory free xmlpgparafree(param); pst_free(&pst); return out; }