这篇教程C++ u_strdup函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中u_strdup函数的典型用法代码示例。如果您正苦于以下问题:C++ u_strdup函数的具体用法?C++ u_strdup怎么用?C++ u_strdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了u_strdup函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: epr_add_selectorstatic int epr_add_selector(epr_t *epr, const char *name, selector_entry *selector) { int i; Selector *p; if(epr == NULL) return 0; p = epr->refparams.selectorset.selectors; for(i = 0; i< epr->refparams.selectorset.count; i++) { if(p->name && ( strcmp(name, p->name) == 0 ) ) { return -1; } p++; } p = epr->refparams.selectorset.selectors; p = u_realloc(p, (epr->refparams.selectorset.count+1) * sizeof(Selector)); if(p == NULL) return -1; p[epr->refparams.selectorset.count].name = u_strdup(name); p[epr->refparams.selectorset.count].type = selector->type; if(selector->type == 0) { if (selector->entry.text) { p[epr->refparams.selectorset.count].value = u_strdup(selector->entry.text); } } else { p[epr->refparams.selectorset.count].value = (char *)epr_copy(selector->entry.eprp); } epr->refparams.selectorset.selectors = p; epr->refparams.selectorset.count++; return 0; }
开发者ID:gyaneshvar,项目名称:Openwsman,代码行数:29,
示例2: main/** * This program is designed for test purpose only. */int main(int /*argc*/,char * /* argv*/ []) {setBufferMode();unichar* inflected=u_strdup("abcdegfh");unichar* lemma=u_strdup("hbc");unichar result[1024];return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:10,
示例3: wsman_get_fragment_typevoid wsman_get_fragment_type(char *fragstr, int *fragment_flag, char **element, int *index){ char *p, *p1, *p2, *dupstr; *fragment_flag = 0; *element = NULL; *index = 0; if(fragstr == NULL) return; dupstr = u_strdup(fragstr); p = strstr(dupstr, "/text()"); if(p) { *p = '/0'; *fragment_flag = 2; *element = u_strdup(dupstr); } else { if((p1 = strstr(dupstr, "[")) && (p2 = strstr(dupstr, "]"))) { *element = u_strndup(dupstr, p1 - dupstr); *p2 = '/0'; *index = atoi(p1+1); *fragment_flag = 3; } else { *element = u_strdup(dupstr); *fragment_flag = 1; } } u_free(dupstr);}
开发者ID:juergh,项目名称:dash-sdk,代码行数:29,
示例4: u_strdupchar *wsman_transport_get_agent(WsManClient * cl){ if (cl->user_agent) return u_strdup(cl->user_agent); else return u_strdup(DEFAULT_USER_AGENT);}
开发者ID:Openwsman,项目名称:openwsman,代码行数:7,
示例5: display_hypotheses/** * Prints the given hypotheses to the output, and if needed, * print the word to the modified input file. */static void display_hypotheses(unichar* word,SpellCheckHypothesis* list,SpellCheckConfig* cfg) {Ustring* line=new_Ustring(128);int printed=0;while (list!=NULL) { printed=1; struct dela_entry* entry=tokenize_DELAF_line(list->entry); if (entry==NULL) { fatal_error("Internal error in display_hypotheses; cannot tokenize entry:/n%S/n",list->entry); } unichar* inflected=entry->inflected; entry->inflected=u_strdup(word); entry->semantic_codes[entry->n_semantic_codes++]=u_strdup("SP_ERR"); u_sprintf(line,"SP_INF=%S",inflected); entry->semantic_codes[entry->n_semantic_codes++]=u_strdup(line->str); dela_entry_to_string(line,entry); u_fprintf(cfg->out,"%S/score=%d/n",line->str,list->score); free(inflected); free_dela_entry(entry); list=list->next;}free_Ustring(line);/* Now, we may have to print the word to the modified input file */if (cfg->input_op=='M') { /* If we must keep matched words, then we print the word if it had matched */ if (printed) u_fprintf(cfg->modified_input,"%S/n",word);} else if (cfg->input_op=='U') { /* If we must keep unmatched words, then we print the word if it had matched */ if (!printed) u_fprintf(cfg->modified_input,"%S/n",word);}}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:34,
示例6: u_mallocepr_t *epr_copy(epr_t *epr){ int i; Selector *p1; Selector *p2; epr_t *cpy_epr = NULL; if(epr == NULL) return cpy_epr; cpy_epr = u_malloc(sizeof(epr_t)); if (epr && epr->address) cpy_epr->address = u_strdup(epr->address); cpy_epr->refparams.uri = u_strdup(epr->refparams.uri); cpy_epr->refparams.selectorset.count = epr->refparams.selectorset.count; cpy_epr->refparams.selectorset.selectors = u_malloc(sizeof(Selector)* epr->refparams.selectorset.count); p1 = epr->refparams.selectorset.selectors; p2 = cpy_epr->refparams.selectorset.selectors; for(i = 0; i < epr->refparams.selectorset.count; i++) { p2->name = u_strdup(p1->name); p2->type = p1->type; if(p1->type == 0) p2->value = u_strdup(p1->value); else p2->value = (char *)epr_copy((epr_t*)p1->value); p1++; p2++; } return cpy_epr;}
开发者ID:gyaneshvar,项目名称:Openwsman,代码行数:32,
示例7: new_token_t/** * This function allocates and returns a token_t structure corresponding to the given * string. */token_t* new_token_t(unichar* str) {token_t* tok=(token_t*)malloc(sizeof(token_t));if (tok==NULL) { fatal_alloc_error("new_token_t");}for (const keyword_t* key=keywords;key->str!=NULL;key++) { if (!u_strcmp(str, key->str)) { /* If the token is a keyword */ tok->type=key->val; tok->str= NULL; tok->next=NULL; return tok; }}if (*str=='<') { /* If we have a '<', we look for the ending '>' */ unichar* p=u_strchr(str,'>'); if (p==NULL || *(p+1)!='/0') { fatal_error("Invalid token: '%S'/n",str); } *p='/0'; tok->type=TOK_ANGLE; /* We copy the content between the angle brackets */ tok->str=u_strdup(str+1); tok->next=NULL; return tok;}/* Otherwise, we create a default token with the string */tok->type=TOK_STR;tok->str=u_strdup(str);tok->next=NULL;return tok;}
开发者ID:adri87,项目名称:Q-A,代码行数:37,
示例8: klog_args/** * /brief create a /c klog_args_t object with configuration parameters read * from a log subsection of a kloned configuration file * * /param ls a log configuration record * /param pka the corresponding /c klog_args_t object as a value-result * argument * /return * - /c 0 success * - /c ~0 on failure (/p pka MUST not be referenced) */int klog_args (u_config_t *ls, klog_args_t **pka){ const char *cs; klog_args_t *ka = NULL; dbg_return_if (ls == NULL, ~0); dbg_return_if (pka == NULL, ~0); /* here defaults are set */ dbg_err_if (klog_args_new(&ka)); /* read in config values */ ka->type = klog_type(u_config_get_subkey_value(ls, "type")); if ((cs = u_config_get_subkey_value(ls, "ident")) != NULL) ka->ident = u_strdup(cs); ka->threshold = klog_threshold(u_config_get_subkey_value(ls, "threshold")); if ((cs = u_config_get_subkey_value(ls, "memory.limit")) != NULL) { dbg_err_ifm (u_atoi(cs, &ka->mlimit), "'memory.limit' bad value: %s", cs); } if ((cs = u_config_get_subkey_value(ls, "file.basename")) != NULL) ka->fbasename = u_strdup(cs); if ((cs = u_config_get_subkey_value(ls, "file.limit")) != NULL) { dbg_err_ifm (u_atoi(cs, &ka->flimit), "'file.limit' bad value: %s", cs); } if ((cs = u_config_get_subkey_value(ls, "file.splits")) != NULL) { dbg_err_ifm (u_atoi(cs, &ka->fsplits), "'file.splits' bad value: %s", cs); } #ifdef HAVE_SYSLOG ka->sfacility = klog_facility(ka, u_config_get_subkey_value(ls, "syslog.facility")); ka->soptions = klog_logopt(u_config_get_subkey_value(ls, "syslog.options")); #endif dbg_return_if (klog_args_check(ka), ~0); *pka = ka; return 0;err: if (ka) klog_args_free(ka); return ~0;}
开发者ID:DanielTillett,项目名称:klone,代码行数:68,
示例9: reg2grf/** * This function takes a unicode string representing a regular expression and * compiles it into a .grf file. It returns 1 in case of success; 0 otherwise. */int reg2grf(const unichar* regexp,const char* name_grf, const VersatileEncodingConfig* vec) {if (regexp[0]=='/0') { error("You must specify a non empty regular expression/n"); return 0;}U_FILE* out=u_fopen(vec,name_grf,U_WRITE);if (out==NULL) { error("Cannot open the output file for the regular expression/n"); return 0;}struct reg2grf_info* INFO=new_reg2grf_info();/* We create the initial and final states that must have numbers 0 and 1 */add_state(INFO,u_strdup("<E>"));add_state(INFO,u_strdup(""));/* We print the grf header */u_fprintf(out,"#Unigraph/n");u_fprintf(out,"SIZE 1313 950/n");u_fprintf(out,"FONT Times New Roman: 12/n");u_fprintf(out,"OFONT Times New Roman:B 12/n");u_fprintf(out,"BCOLOR 16777215/n");u_fprintf(out,"FCOLOR 0/n");u_fprintf(out,"ACOLOR 12632256/n");u_fprintf(out,"SCOLOR 16711680/n");u_fprintf(out,"CCOLOR 255/n");u_fprintf(out,"DBOXES y/n");u_fprintf(out,"DFRAME y/n");u_fprintf(out,"DDATE y/n");u_fprintf(out,"DFILE y/n");u_fprintf(out,"DDIR y/n");u_fprintf(out,"DRIG n/n");u_fprintf(out,"DRST n/n");u_fprintf(out,"FITS 100/n");u_fprintf(out,"PORIENT L/n");u_fprintf(out,"#/n");int input_state;int output_state;int result=reg_2_grf(regexp,&input_state,&output_state,INFO);if (result!=1) { u_fclose(out); af_remove(name_grf); free_reg2grf_info(INFO); if (result==0) { error("Syntax error in regular expression/n"); } return 0;}/* If the compilation has successed, we must link the resulting automaton piece * to the grf's initial and final states */add_transition(0,input_state,INFO);add_transition(output_state,1,INFO);save_states(out,INFO);free_reg2grf_info(INFO);u_fclose(out);return 1;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:60,
示例10: subsequential_to_normal_transducer/** * This function moves outputs from final nodes to transitions leading to final nodes. */static void subsequential_to_normal_transducer(struct dictionary_node* root, struct dictionary_node* node, struct string_hash* inf_codes, int pos,unichar* z, Ustring* normalizedOutput) {struct dictionary_node_transition* tmp=node->trans;int prefix_set=0;Ustring* prefix=new_Ustring();while (tmp!=NULL) { z[pos]=tmp->letter; z[pos+1]='/0'; subsequential_to_normal_transducer(root,tmp->node,inf_codes,pos+1,z,normalizedOutput); /* First, if the destination state is final, we place its output on the output * of the current transition */ if (tmp->node->single_INF_code_list!=NULL) { //error("<%S>: output=<%S>/n",z,normalizedOutput->str); tmp->output=u_strdup(inf_codes->value[tmp->node->INF_code]); } if (normalizedOutput->len!=0) { /* Then, we add the normalized output obtained recursively, if any */ //error("<%S>: moving normalized output <%S>/n",z,normalizedOutput->str); if (tmp->output==NULL) { tmp->output=u_strdup(normalizedOutput->str); } else { tmp->output=(unichar*)realloc(tmp->output,sizeof(unichar)*(1+normalizedOutput->len+u_strlen(tmp->output))); } } if (!prefix_set) { prefix_set=1; u_strcpy(prefix,tmp->output); } else { get_longest_common_prefix(prefix,tmp->output); } tmp=tmp->next;}if (node==root || node->single_INF_code_list!=NULL) { /* If we are in the initial state or a final one, we let the transitions as they are, since * their outputs can not move more to the left */ z[pos]='/0'; free_Ustring(prefix); empty(normalizedOutput); return;}tmp=node->trans;while (tmp!=NULL) { //error("prefix removal: <%S> => ",tmp->output); remove_prefix(prefix->len,tmp->output); //error("<%S>/n",tmp->output); tmp=tmp->next;}z[pos]='/0';u_strcpy(normalizedOutput,prefix);free_Ustring(prefix);}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:58,
示例11: range_set_name/** * Set the range's name to a new value * @param r the range in question * @param name the new name (maybe like the old one) * @return 1 if it worked, else 0 */int range_set_name( range *r, UChar *name ){ if ( r->name == NULL ) r->name = u_strdup( name ); else if ( u_strcmp(r->name,name)!= 0 ) { free( r->name ); r->name = u_strdup( name ); } return r->name != NULL;}
开发者ID:Ecdosis,项目名称:calliope,代码行数:17,
示例12: calloc/** * * @param n_props number of properties (html_tags+property-names) * @param properties array of props and html tag names alternately * @return an initialised matrix */matrix *matrix_create( int n_props, UChar **properties ){ matrix *m = calloc(1,sizeof(matrix) ); if ( m != NULL ) { m->n_props = n_props/2; m->names = calloc( m->n_props, sizeof(UChar*) ); m->html_tags = calloc( m->n_props, sizeof(UChar*) ); if ( m->names != NULL && m->html_tags != NULL ) { int i,j; for ( j=0,i=0;i<n_props-1;j++,i+=2 ) { m->names[j] = u_strdup(properties[i]); //printf("%s/n",properties[i]); m->html_tags[j] = (properties[i+1]==NULL) ?NULL:u_strdup(properties[i+1]); } m->cells = (int*)calloc( m->n_props*m->n_props, sizeof(int) ); if ( m->cells == NULL ) { matrix_dispose( m ); m = NULL; warning("failed to allocate %dx%d matrix/n",n_props,n_props); } else { m->lookup = hashset_create(); if ( m->lookup == NULL ) { matrix_dispose( m ); m = NULL; } else { int k; for ( k=0;k<m->n_props;k++ ) { hashset_put( m->lookup, m->names[k] ); } } } } else { warning("matrix: failed to allocate names and tags/n"); matrix_dispose( m ); m = NULL; } } return m;}
开发者ID:Ecdosis,项目名称:calliope,代码行数:58,
示例13: key_value_copyvoidkey_value_copy(const key_value_t *from, key_value_t *to){ if (from->key) to->key = u_strdup(from->key); else to->key = NULL; to->type = from->type; if (from->type == 0) to->v.text = u_strdup(from->v.text); else to->v.epr = epr_copy(from->v.epr);}
开发者ID:Openwsman,项目名称:openwsman,代码行数:13,
示例14: new_corpus_entry/** * Allocates, initializes and returns a new corpus_entry structure. */struct corpus_entry* new_corpus_entry(const unichar* line){struct corpus_entry* entry = (corpus_entry*)malloc(sizeof(corpus_entry));if(entry == NULL){ fatal_alloc_error("compute_corpus_entry");}/* we fill corpus entry with information extracted from the corpus line*/int pos = u_strrchr(line,'/');if(pos == -1){ fatal_error("Wrong format for line %S/n",line);}entry->word = (unichar*)malloc(sizeof(unichar)*(pos+1));if(entry->word == NULL){ fatal_alloc_error("compute_corpus_entry");}unichar* tmp = u_strcpy_sized(entry->word,pos+1,line);u_strcat(tmp,"/0");int code_pos = u_strrchr(line,':');/* there are no morphological codes associated to this entry */if(code_pos == -1){ entry->pos_code = (unichar*)malloc(sizeof(unichar)*(u_strlen(line)-pos)); if(entry->pos_code == NULL){ fatal_alloc_error("new_corpus_entry"); } u_strcpy(entry->pos_code,&line[pos+1]); entry->overall_codes = u_strdup(entry->pos_code);}else{ entry->pos_code = (unichar*)malloc(sizeof(unichar)*(code_pos-pos)); if(entry->pos_code == NULL){ fatal_alloc_error("new_corpus_entry"); } entry->overall_codes = (unichar*)malloc(sizeof(unichar)*(u_strlen(line)-pos)); if(entry->overall_codes == NULL){ fatal_alloc_error("new_corpus_entry"); } unichar* tmp2 = u_strcpy_sized(entry->pos_code,code_pos-pos,&line[pos+1]); u_strcat(tmp2,"/0"); u_strcpy(entry->overall_codes,&line[pos+1]);}/* if the token is not annotated in the corpus, we put "UNK" */if(u_strlen(entry->pos_code) == 0){ free(entry->pos_code); free(entry->overall_codes); entry->pos_code = u_strdup("UNK"); entry->overall_codes = u_strdup("UNK");}return entry;}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:52,
示例15: unif_instantiate//////////////////////////////////////////////////////////////////////////////////// If variable "var" already instantiated, returns -1. Otherwise,// instantiates the unification variable "var" to category "cat" and value "val". // Returns 1 or -1 in case of error, 0 otherwise.int unif_instantiate(MultiFlex_ctx* p_multiFlex_ctx,unichar* var, l_category_T* cat, unichar* val) { int i; int v; //Check if not yet instantiated. if (unif_instantiated(p_multiFlex_ctx,var)) return -1; i = (p_multiFlex_ctx->UNIF_VARS).no_vars; //Category (p_multiFlex_ctx->UNIF_VARS).vars[i].cat = cat; //value v = is_valid_val(cat,val); if (v == -1) { error("Instantiation impossible: %S is an invalid value in category %S./n",val,cat->name); return 1; } (p_multiFlex_ctx->UNIF_VARS).vars[i].val = v; //id (p_multiFlex_ctx->UNIF_VARS).vars[i].id = u_strdup(var); (p_multiFlex_ctx->UNIF_VARS).no_vars++; return 0;}
开发者ID:adri87,项目名称:Q-A,代码行数:30,
示例16: klog_logopt/* map threshold directive to the internal representation */static int klog_logopt (const char *options){ char *o2 = NULL; /* 'options' dupped for safe u_tokenize() */ int i, logopt = 0; enum { NOPTS = 4 }; char *optv[NOPTS + 1]; dbg_return_if (options == NULL, 0); dbg_return_if ((o2 = u_strdup(options)) == NULL, 0); dbg_err_if (u_tokenize(o2, " /t", optv, NOPTS + 1)); for (i = 0; optv[i] != NULL; i++) { if (!strcasecmp(optv[i], "LOG_CONS")) logopt |= LOG_CONS; else if (!strcasecmp(optv[i], "LOG_NDELAY")) logopt |= LOG_NDELAY;#ifdef HAVE_LOG_PERROR else if (!strcasecmp(optv[i], "LOG_PERROR")) logopt |= LOG_PERROR;#endif /* HAVE_LOG_PERROR */ else if (!strcasecmp(optv[i], "LOG_PID")) logopt |= LOG_PID; else warn("bad log option: /'%s/'", optv[i]); } U_FREE(o2); return logopt;err: U_FREE(o2); return 0;}
开发者ID:DanielTillett,项目名称:klone,代码行数:36,
示例17: lemmatizevoid lemmatize(struct dela_entry* e,struct string_hash_ptr* keywords,Alphabet* alphabet) {unichar* lower=u_strdup(e->inflected);u_tolower(lower);KeyWord* k_inflected=(KeyWord*)get_value(lower,keywords);free(lower);if (k_inflected==NULL) return;Ustring* tmp=new_Ustring(64);u_sprintf(tmp,"%S.%S",e->lemma,e->semantic_codes[0]);KeyWord* k_lemma=(KeyWord*)get_value(tmp->str,keywords);if (k_lemma==NULL) { k_lemma=new_KeyWord(0,tmp->str,NULL); k_lemma->lemmatized=LEMMATIZED_KEYWORD; get_value_index(tmp->str,keywords,INSERT_IF_NEEDED,k_lemma);}/* Now, we look for all the case compatible tokens, and we add * their weights to the new lemmatized element */while (k_inflected!=NULL) { if (k_inflected->sequence!=NULL && is_equal_or_uppercase(e->inflected,k_inflected->sequence,alphabet)) { /* We have a match */ k_lemma->weight+=k_inflected->weight; k_inflected->lemmatized=1; } k_inflected=k_inflected->next;}free_Ustring(tmp);}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:27,
示例18: sysfile_setRootPathboolsysfile_setRootPath(const char *name){ char *path = u_strdup(name); if (!path) { return false; } rootPath.name = str_toNativeSeparators(path);#ifdef ENABLE_ZIP if (str_hasZipExtension(rootPath.name)) { rootPath.zip = unzOpen(rootPath.name); if (!rootPath.zip) { sys_error("(sysfile) can not open zip file /"%s/"",rootPath.name); return false; } } else /* dealing with a directory */ { /* FIXME check that it is a valid directory */ rootPath.zip = NULL; }#endif /* ENABLE_ZIP */ return true;}
开发者ID:foolsh,项目名称:xrick,代码行数:28,
示例19: calloc/** * Create a single range * @param name the name of the property * @param html_name the range's mapped html name * @param start its start offset inside the text * @param len its length * @return the finished range */range *range_create( UChar *name, UChar *html_name, int start, int len ){ range *r = calloc( 1, sizeof(range) ); if ( r != NULL ) { r->name = u_strdup(name); if ( html_name != NULL ) r->html_name = u_strdup( html_name ); r->start = start; r->len = len; r->rightmost = 1; } else warning("range creation failed/n"); return r;}
开发者ID:Ecdosis,项目名称:calliope,代码行数:24,
示例20: unif_instantiate//////////////////////////////////////////////////////////////////////////////////// If variable "var" already instantiated, returns -1. Otherwise,// instantiates the unification variable "var" to category "cat" and value "val". // Returns 1 or -1 in case of error, 0 otherwise.int unif_instantiate(unif_vars_T* UNIF_VARS,unichar* var, l_category_T* cat, unichar* val) { int i; int v; //Check if not yet instantiated. if (unif_instantiated(UNIF_VARS,var)) return -1; i = UNIF_VARS->no_vars; //Category UNIF_VARS->vars[i].cat = cat; //value v = is_valid_val(cat,val); if (v == -1) { error("Instantiation impossible: %S is an invalid value in category %S./n",val,cat->name); return 1; } UNIF_VARS->vars[i].val = v; //id UNIF_VARS->vars[i].id = u_strdup(var); UNIF_VARS->no_vars++; return 0;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:30,
示例21: WsManTest_EventPoll_EPintWsManTest_EventPoll_EP(WsEventThreadContextH threadcntx){ int retval = 0; WsNotificationInfoH notificationinfo = u_malloc(sizeof(*notificationinfo)); if(notificationinfo == NULL) return -1; notificationinfo->headerOpaqueData = ws_xml_create_doc( XML_NS_OPENWSMAN"/test", "EventTopics"); WsXmlNodeH node = ws_xml_get_doc_root(notificationinfo->headerOpaqueData); if(node) { ws_xml_set_node_text(node, "openwsman.event.test"); } notificationinfo->EventAction = u_strdup(XML_NS_OPENWSMAN"/EventReport"); notificationinfo->EventContent = ws_xml_create_doc( XML_NS_OPENWSMAN"/test", "TestReport"); if(notificationinfo->EventContent == NULL) return retval; node = ws_xml_get_doc_root(notificationinfo->EventContent); time_t timest = time(0); struct tm tm; localtime_r(×t, &tm); ws_xml_add_child_format(node, XML_NS_OPENWSMAN"/test", "EventTime","%u-%u%u-%u%uT%u%u:%u%u:%u%u", tm.tm_year + 1900, (tm.tm_mon + 1)/10, (tm.tm_mon + 1)%10, tm.tm_mday/10, tm.tm_mday%10, tm.tm_hour/10, tm.tm_hour%10, tm.tm_min/10, tm.tm_min%10, tm.tm_sec/10, tm.tm_sec%10); EventPoolOpSetH opset = threadcntx->soap->eventpoolOpSet; if(threadcntx->subsInfo->deliveryMode == WS_EVENT_DELIVERY_MODE_PULL) retval = opset->addpull(threadcntx->subsInfo->subsId, notificationinfo); else retval = opset->add(threadcntx->subsInfo->subsId, notificationinfo); if(retval) { u_free(notificationinfo->EventAction); ws_xml_destroy_doc(notificationinfo->EventContent); ws_xml_destroy_doc(notificationinfo->headerOpaqueData); u_free(notificationinfo); } return 0;}
开发者ID:kolbma,项目名称:openwsman,代码行数:35,
示例22: wsman_get_option_setchar *wsman_get_option_set(WsContextH cntx, WsXmlDocH doc, const char *op){ char *optval = NULL; int index = 0; WsXmlNodeH node, option; if (doc == NULL) { doc = cntx->indoc; if (!doc) return NULL; } node = ws_xml_get_soap_header(doc); if (node && (node = ws_xml_get_child(node, 0, XML_NS_WS_MAN, WSM_OPTION_SET))) { while ((option = ws_xml_get_child(node, index++, XML_NS_WS_MAN, WSM_OPTION))) { char *attrVal = ws_xml_find_attr_value(option, NULL, WSM_NAME); if (attrVal && strcmp(attrVal, op ) == 0 ) { optval = ws_xml_get_node_text(option); if (optval[0] == 0) optval = "true"; optval = u_strdup(optval); debug("Option: %s=%s", attrVal, optval); break; } } } return optval;}
开发者ID:juergh,项目名称:dash-sdk,代码行数:32,
示例23: clone/** * Returns a clone of the pattern. */struct pattern* clone(const struct pattern* src,Abstract_allocator prv_alloc) { struct pattern* dst; if (src == NULL) return NULL; dst=(struct pattern*)malloc_cb(sizeof(struct pattern),prv_alloc); if (dst==NULL) { fatal_error("Not enough memory in new_pattern_ByCopy/n"); } dst->inflected=u_strdup(src->inflected,prv_alloc); dst->lemma=u_strdup(src->lemma,prv_alloc); dst->grammatical_codes=clone(src->grammatical_codes,prv_alloc); dst->inflectional_codes=clone(src->inflectional_codes,prv_alloc); dst->forbidden_codes=clone(src->forbidden_codes,prv_alloc); dst->type=src->type; return dst;}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:21,
示例24: new_tagset_t/** * Allocates, initializes and returns a new tagset_t structure. */tagset_t* new_tagset_t(unichar* name) {tagset_t* tree=(tagset_t*)malloc(sizeof(tagset_t));if (tree==NULL) { fatal_alloc_error("new_tagset_t");}tree->name=u_strdup(name);tree->pos_sections=NULL;return tree;}
开发者ID:adri87,项目名称:Q-A,代码行数:12,
示例25: wsmc_create_delivery_mode_strstatic char *wsmc_create_delivery_mode_str(WsmanDeliveryMode mode){ char * str = NULL; switch(mode) { case WSMAN_DELIVERY_PUSH: str = u_strdup(WSEVENT_DELIVERY_MODE_PUSH); break; case WSMAN_DELIVERY_PUSHWITHACK: str = u_strdup(WSEVENT_DELIVERY_MODE_PUSHWITHACK); break; case WSMAN_DELIVERY_EVENTS: str = u_strdup(WSEVENT_DELIVERY_MODE_EVENTS); break; case WSMAN_DELIVERY_PULL: str = u_strdup(WSEVENT_DELIVERY_MODE_PULL); } return str;}
开发者ID:gyaneshvar,项目名称:Openwsman,代码行数:19,
示例26: new_norm_info/** * Allocates, initializes and returns a new norm_info structure. */struct norm_info* new_norm_info(const unichar* output,struct normalization_tree* n) {struct norm_info* t=(struct norm_info*)malloc(sizeof(struct norm_info));if (t==NULL) { fatal_alloc_error("new_norm_info");}t->output=u_strdup(output);t->node=n;t->next=NULL;return t;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:13,
示例27: initialize_context_matrix/** * Frees all the memory associated to the given matrix of corpus_entry structure. */void initialize_context_matrix(struct corpus_entry** context){for(int i=0;i<MAX_CONTEXT;i++){ if(context[i] != NULL){ free_corpus_entry(context[i]); } unichar* str = u_strdup("#/#"); context[i] = new_corpus_entry(str); free(str);}}
开发者ID:anukat2015,项目名称:unitex-core,代码行数:13,
示例28: new_debug_tfst_match/** * Allocates, initializes and returns a new debug tfst_match. */struct tfst_match* new_debug_tfst_match(const unichar* output,struct tfst_match* next) {struct tfst_match* match=(struct tfst_match*)malloc(sizeof(struct tfst_match));if (match==NULL) { fatal_alloc_error("new_debug_tfst_match");}match->debug_output=u_strdup(output);match->fst2_transition=NULL;match->text_tag_numbers=NULL;match->next=next;return match;}
开发者ID:Rajat-dhyani,项目名称:UnitexGramLab,代码行数:14,
示例29: new_couple/** * Allocates, initializes and returns a new couple. */struct couple* new_couple(unichar* s) { struct couple* c = (struct couple*) malloc(sizeof(struct couple)); if (c == NULL) { alloc_error("new_couple"); return NULL; } c->next = NULL; c->n = 1; c->s = u_strdup(s); return c;}
开发者ID:UnitexGramLab,项目名称:unitex-core,代码行数:14,
注:本文中的u_strdup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ u_strncpy函数代码示例 C++ u_strcpy函数代码示例 |