您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ string_dup函数代码示例

51自学网 2021-06-03 08:30:10
  C++
这篇教程C++ string_dup函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中string_dup函数的典型用法代码示例。如果您正苦于以下问题:C++ string_dup函数的具体用法?C++ string_dup怎么用?C++ string_dup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了string_dup函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: loggerwindow_log

void loggerwindow_log(LoggerWindow *lw, char *line) {	if (lw->nloglines==lw->logsize) {		lw->loglines= memdbl(lw->loglines, &lw->logsize, sizeof(*lw->loglines));	}		lw->loglines[lw->nloglines++]= string_dup(line);	scrollbar_set_thumbpct(lw->scroll, (float) lw->ndisplines/lw->nloglines);		GHOST_InvalidateWindow(lw->win);}
开发者ID:MakersF,项目名称:BlenderDev,代码行数:10,


示例2: dup_node_partition

/** * @brief *		dup_node_partition - duplicate a node_partition structure * * @param[in]	onp	-	the node_partition structure to duplicate * @param[in]	nsinfo	-	server for the new node partiton (the nodes are needed) * * @return	duplicated node_partition * @retval	NULL	: on error * */node_partition *dup_node_partition(node_partition *onp, server_info *nsinfo){	node_partition *nnp;	if (onp == NULL)		return NULL;	if ((nnp = new_node_partition()) == NULL)		return NULL;	if (onp->name != NULL)		nnp->name = string_dup(onp->name);	if (onp->def != NULL)		nnp->def = onp->def;	if (onp->res_val != NULL)		nnp->res_val = string_dup(onp->res_val);	nnp->ok_break = onp->ok_break;	nnp->excl = onp->excl;	nnp->tot_nodes = onp->tot_nodes;	nnp->free_nodes = onp->free_nodes;	nnp->res = dup_resource_list(onp->res);#ifdef NAS /* localmod 049 */	nnp->ninfo_arr = copy_node_ptr_array(onp->ninfo_arr, nsinfo->nodes, nsinfo);#else	nnp->ninfo_arr = copy_node_ptr_array(onp->ninfo_arr, nsinfo->nodes);#endif	nnp->bkts = dup_node_bucket_array(onp->bkts, nsinfo);	nnp->rank = onp->rank;	/* validity check */	if (onp->name == NULL || onp->res_val == NULL ||		nnp->res == NULL || nnp->ninfo_arr == NULL) {		free_node_partition(nnp);		return NULL;	}	return nnp;}
开发者ID:Klovely,项目名称:pbspro,代码行数:53,


示例3: save_pair_data

static void save_pair_data(tg_pair_t *pair) {    HacheIter *iter;    HacheItem *hi;    pair_data *save_pair;    string_alloc_t *str_pool;    int i = 0, i_max;    pair_queue_t *que;        if (NULL == (save_pair = (pair_data *)malloc(sizeof(pair_data) * pair->write_size))) {    	fprintf(stderr, "Can't allocate memory in save_pair_data/n");	return;    }        str_pool = string_pool_create(1024 * 1024);        if (NULL == str_pool) {    	fprintf(stderr, "Can't allocate string pool memory in save_pair_data/n");	return;    }        iter = HacheTableIterCreate();    while ((hi = HacheTableIterNext(pair->phache, iter))) {	save_pair[i].tname = string_dup(str_pool, hi->key);	save_pair[i].data  = pair_to_pooled_string(str_pool, (pair_loc_t *)hi->data.p);    	i++;	    }        i_max = i;        HacheTableIterDestroy(iter);        qsort(save_pair, pair->count, sizeof(pair_data), cmp_pair);        que = add_pair_queue(pair);        if (NULL == que) {    	fprintf(stderr, "Can't create new pair queue/n");	return;    }    for (i = 0; i < i_max; i++) {    	fprintf(que->fp, "%s %s/n", save_pair[i].tname, save_pair[i].data);    }    if (HacheTableEmpty(pair->phache, 1)) {    	// TEST TEST TEST need to put in proper fail    	fprintf(stderr, "save_pair_data failed on HacheTableEmpty/n");    }        string_pool_destroy(str_pool);    free(save_pair);    fflush(que->fp);}
开发者ID:nathanhaigh,项目名称:staden-trunk,代码行数:54,


示例4: op_strpush

voidop_strpush(void){    Var		s;    int		symno;    symno = frame.m->code[frame.pc++];    s.type = STR;    s.v.str = string_dup(sym_get(frame.on, symno));    push(s);}
开发者ID:carriercomm,项目名称:coolmud,代码行数:11,


示例5: new_mfunc

intnew_mfunc(const char *funcname, const char *buf){	if (strlen(funcname) > MAX_MFUN_NAME_LEN)		return 1;	if (funcc > MPI_MAX_FUNCTIONS)		return 2;	strcpyn(funcv[funcc].name, sizeof(funcv[funcc].name), funcname);	funcv[funcc++].buf = (char *) string_dup(buf);	return 0;}
开发者ID:PyroMuddypaw,项目名称:fuzzball,代码行数:11,


示例6: store_data

static voidstore_data(	const char *name,	const char *type){	MYDATA *p = (MYDATA *) malloc(sizeof(MYDATA));	MYDATA *q;	p->link = 0;	p->name = string_dup(name);	p->type = string_dup(type);	if ((q = all_data) == 0)		all_data = p;	else {		while (q->link != 0)			q = q->link;		q->link = p;	}}
开发者ID:joshtriplett,项目名称:tin-sample,代码行数:20,


示例7: str_grid_patch_filler_new

str_grid_patch_filler_t* str_grid_patch_filler_new(const char* name,                                                   void* context,                                                   str_grid_patch_filler_vtable vtable){  ASSERT(vtable.start_filling_cells != NULL);  str_grid_patch_filler_t* filler = GC_MALLOC(sizeof(str_grid_patch_filler_t));  filler->name = string_dup(name);  filler->context = context;  filler->vtable = vtable;  GC_register_finalizer(filler, str_grid_patch_filler_free, filler, NULL, NULL);  return filler;}
开发者ID:polymec,项目名称:polyamri-dev,代码行数:12,


示例8: shell_setenv_root

void shell_setenv_root(const char *name, char *value) {	struct environment *environment = _environment;	char *old;	while(environment->previous) {		environment = environment->previous;	}	old = (char *)str2ptr_set(environment->variables, name, (void *)string_dup(value));	if(old) {		free(old);	}}
开发者ID:discolodaold,项目名称:Tensor,代码行数:12,


示例9: init_game

intinit_game(const char *infile, const char *outfile){	FILE *f;	if ((f = fopen(MACRO_FILE, "rb")) == NULL)		log_status("INIT: Macro storage file %s is tweaked.", MACRO_FILE);	else {		macroload(f);		fclose(f);	}	in_filename = (char *) string_dup(infile);	if ((input_file = fopen(infile, "rb")) == NULL)		return -1;#ifdef DELTADUMPS	if ((delta_outfile = fopen(DELTAFILE_NAME, "wb")) == NULL)		return -1;	if ((delta_infile = fopen(DELTAFILE_NAME, "rb")) == NULL)		return -1;#endif	db_free();	init_primitives();			/* init muf compiler */	mesg_init();				/* init mpi interpreter */	SRANDOM(getpid());			/* init random number generator */	tune_load_parmsfile(NOTHING);	/* load @tune parms from file */	/* ok, read the db in */	log_status("LOADING: %s", infile);	fprintf(stderr, "LOADING: %s/n", infile);	if (db_read(input_file) < 0)		return -1;	log_status("LOADING: %s (done)", infile);	fprintf(stderr, "LOADING: %s (done)/n", infile);	/* set up dumper */	if (dumpfile)		free((void *) dumpfile);	dumpfile = alloc_string(outfile);	if (!db_conversion_flag) {		/* initialize the _sys/startuptime property */		add_property((dbref) 0, "_sys/startuptime", NULL, (int) time((time_t *) NULL));		add_property((dbref) 0, "_sys/maxpennies", NULL, tp_max_pennies);		add_property((dbref) 0, "_sys/dumpinterval", NULL, tp_dump_interval);		add_property((dbref) 0, "_sys/max_connects", NULL, 0);	}	return 0;}
开发者ID:rhencke,项目名称:fuzzball,代码行数:53,


示例10: copyinst

voidcopyinst(struct inst *from, struct inst *to){	assert(from && to);	int j, varcnt;	*to = *from;	switch(from->type) {	case PROG_FUNCTION:	    if (from->data.mufproc) {			to->data.mufproc = (struct muf_proc_data*)malloc(sizeof(struct muf_proc_data));			to->data.mufproc->procname = string_dup(from->data.mufproc->procname);			to->data.mufproc->vars = varcnt = from->data.mufproc->vars;			to->data.mufproc->args = from->data.mufproc->args;			to->data.mufproc->varnames = (const char**)calloc(varcnt, sizeof(const char*));			for (j = 0; j < varcnt; j++) {				to->data.mufproc->varnames[j] = string_dup(from->data.mufproc->varnames[j]);			}		}		break;	case PROG_STRING:	    if (from->data.string) {			from->data.string->links++;		}		break;	case PROG_ARRAY:	    if (from->data.array) {			from->data.array->links++;		}		break;	case PROG_ADD:		from->data.addr->links++;		PROGRAM_INC_INSTANCES(from->data.addr->progref);		break;	case PROG_LOCK:	    if (from->data.lock != TRUE_BOOLEXP) {			to->data.lock = copy_bool(from->data.lock);		}		break;	}}
开发者ID:rhencke,项目名称:fuzzball,代码行数:40,


示例11: ossfim2map

void ossfim2map(double **table, const char *name, double s, double S,	double b, double B, int dx, int dy) {		GRIDMAP *m;	TICKS x, y;	char str[100];	int i, j;	extern int nice_legend;	double bs;		m = new_map();	m->filename = name;	m->rows = dy + 1;	m->cols = dx + 1;	m->cellsizex = m->cellsizey = 1.0;	m->x_ul = m->y_ul = 1.0;	alloc_mv_grid(m);	for (i = 0; i <= dx; i++) /* row */		for (j = 0; j <= dy; j++) /* col */			map_put_cell(m, dy - j, i, table[i][j]); /* flips */	/* fill ticks */	x.every = y.every = 1;	x.n = dx + 1;	y.n = dy + 1;	x.entries = (char **) emalloc(x.n * sizeof(char *));	for (i = 0; i <= dx; i++) { /* sample spacings: */		sprintf(str, "%3g", s + i * (S - s) / dx);		x.entries[i] = string_dup((char *) str);	}	y.entries = (char **) emalloc(y.n * sizeof(char *));	for (i = 0; i <= dy; i++) { /* sample spacings: */		bs = b + i * (B - b) / dy;		sprintf(str, "%g x %g", bs, bs);		y.entries[dy - i] = string_dup((char *) str);	}	nice_legend = 1;	one_map2gd(m, name, &y, &x, 1);	return;}
开发者ID:Andlon,项目名称:cs267FinalProject,代码行数:40,


示例12: do_abort_interp

voiddo_abort_interp(dbref player, const char *msg, struct inst *pc,				struct inst *arg, int atop, struct frame *fr,				struct inst *oper1, struct inst *oper2,				struct inst *oper3, struct inst *oper4, int nargs,				dbref program, char *file, int line){	char buffer[128];	if (fr->trys.top) {		fr->errorstr = string_dup(msg);		if (pc) {			fr->errorinst = string_dup(insttotext(fr, 0, pc, buffer, sizeof(buffer), 30, program, 1));			fr->errorline = pc->line;		} else {			fr->errorinst = NULL;			fr->errorline = -1;		}		fr->errorprog = program;		err++;	} else {		fr->pc = pc;		calc_profile_timing(program,fr);		interp_err(player, program, pc, arg, atop, fr->caller.st[1],				insttotext(fr, 0, pc, buffer, sizeof(buffer), 30, program, 1), msg);		if (controls(player, program))			muf_backtrace(player, program, STACK_SIZE, fr);	}	switch (nargs) {	case 4:		RCLEAR(oper4, file, line);	case 3:		RCLEAR(oper3, file, line);	case 2:		RCLEAR(oper2, file, line);	case 1:		RCLEAR(oper1, file, line);	}	return;}
开发者ID:rhencke,项目名称:fuzzball,代码行数:40,


示例13: ctrl_k

int	ctrl_k(t_elem *e){  free_string_edit(e->clipboard);  e->clipboard = NULL;  string_dup(e);  my_tputs(e->cap[CD]);  if (e->cursor->next)    free_end_of_clip(e->cursor->next);  e->cursor->c = 0;  e->cursor->next = NULL;  e->len -= taille_clip(e);  return (0);}
开发者ID:Lowfly,项目名称:RSH-Shell,代码行数:13,


示例14: FASTQ_error

void CC FASTQ_error(struct FASTQParseBlock* sb, const char* msg){    if (sb->record->rej == 0)    {   /* save the error information in the Rejected object */        sb->record->rej = (Rejected*)malloc(sizeof(Rejected));        RejectedInit(sb->record->rej);        sb->record->rej->message    = string_dup(msg, strlen(msg));        sb->record->rej->line       = sb->lastToken->line_no;        sb->record->rej->column     = sb->lastToken->column_no;    }    /* subsequent errors in this record will be ignored */}
开发者ID:ncbi,项目名称:sra-tools,代码行数:13,


示例15: polyhedron_integrator_new

polyhedron_integrator_t* polyhedron_integrator_new(const char* name,                                                   void* context,                                                   polyhedron_integrator_vtable vtable){  ASSERT(vtable.set_domain != NULL);  ASSERT(vtable.next_volume_point != NULL);  ASSERT(vtable.next_surface_point != NULL);  polyhedron_integrator_t* integ = polymec_malloc(sizeof(polyhedron_integrator_t));  integ->name = string_dup(name);  integ->context = context;  integ->vtable = vtable;  return integ;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:13,


示例16: get_token

token* get_token(char* token_string)  {  char *colon;  token *this_token = (token *) malloc(sizeof(token));  char *work_string = string_dup(token_string);  colon = strstr(work_string, ":");  this_token->count = atof(colon + 1);  *colon = 0;  this_token->identifier = work_string;  return this_token;  }
开发者ID:actorquedeveloper,项目名称:torque,代码行数:13,


示例17: neighbor_pairing_new

neighbor_pairing_t* neighbor_pairing_new(const char* name, int num_pairs,                                          int* pairs, real_t* weights,                                         exchanger_t* ex){  ASSERT(pairs != NULL);  ASSERT(ex != NULL);  neighbor_pairing_t* p = polymec_malloc(sizeof(neighbor_pairing_t));  p->name = string_dup(name);  p->num_pairs = num_pairs;  p->pairs = pairs;  p->weights = weights;  p->ex = ex;  return p;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:14,


示例18: exodus_file_close

void exodus_file_close(exodus_file_t* file){  if (file->writing)  {    // Write a QA record.    char* qa_record[1][4];    qa_record[0][0] = string_dup(polymec_executable_name());    qa_record[0][1] = string_dup(polymec_executable_name());    time_t invocation_time = polymec_invocation_time();    struct tm* time_data = localtime(&invocation_time);    char date[20], instant[20];    snprintf(date, 19, "%02d/%02d/%02d", time_data->tm_mon, time_data->tm_mday,              time_data->tm_year % 100);    qa_record[0][2] = string_dup(date);    snprintf(instant, 19, "%02d:%02d:%02d", time_data->tm_hour, time_data->tm_min,              time_data->tm_sec % 60);    qa_record[0][3] = string_dup(instant);    ex_put_qa(file->ex_id, 1, qa_record);    for (int i = 0; i < 4; ++i)      string_free(qa_record[0][i]);  }  // Clean up.  if (file->elem_block_ids != NULL)    polymec_free(file->elem_block_ids);  if (file->face_block_ids != NULL)    polymec_free(file->face_block_ids);  if (file->edge_block_ids != NULL)    polymec_free(file->edge_block_ids);  free_all_variable_names(file);#if POLYMEC_HAVE_MPI  MPI_Info_free(&file->mpi_info);#endif  ex_close(file->ex_id);}
开发者ID:jjphatt,项目名称:polyglot-dev,代码行数:36,


示例19: rng_new

rng_t* rng_new(const char* name, void* context,                uint32_t min, uint32_t max, rng_vtable vtable,               bool has_global_state, bool is_thread_safe){  ASSERT(min < max);  ASSERT(vtable.get != NULL);  rng_t* rng = GC_MALLOC(sizeof(rng_t));  rng->name = string_dup(name);  rng->context = context;  rng->min = min;  rng->max = max;  rng->vtable = vtable;  rng->has_global_state = has_global_state;  rng->is_thread_safe = is_thread_safe;  GC_register_finalizer(rng, rng_free, rng, NULL, NULL);  return rng;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:17,


示例20: register_test

/*----------------------------------------------------------------------*/static int register_test(TestItem *test_items, int maximum_number_of_tests, char *specification_name) {    int number_of_tests;    for (number_of_tests = 0; test_items[number_of_tests].specification_name != NULL; number_of_tests++)        ;    if (number_of_tests == maximum_number_of_tests) {        fprintf(stderr, "/nERROR: Found too many tests (%d)! Giving up./nConsider splitting tests between libraries on logical suite boundaries./n", number_of_tests);        return -1;    }    test_items[number_of_tests].specification_name = string_dup(specification_name);    test_items[number_of_tests].context_name = context_name_from_specname(specification_name);    test_items[number_of_tests].test_name = test_name_from_specname(specification_name);    test_items[number_of_tests+1].specification_name = NULL;    return 0;}
开发者ID:hean01-cendio,项目名称:cgreen,代码行数:18,


示例21: options_parse

void options_parse(int argc, char** argv){  if (argv_singleton != NULL)    argv_singleton = NULL;  options_t* o = options_new();  // Parse the basic options.  o->num_args = argc;  o->args = polymec_malloc(sizeof(char*) * o->num_args);  int first_named_value = -1;  for (int i = 0; i < argc; ++i)  {    if (string_contains(argv[i], "=") && (first_named_value == -1))      first_named_value = i;    o->args[i] = string_dup(argv[i]);  }  // Now parse parameters.  int i = (first_named_value == -1) ? 0 : first_named_value;  while (i < argc)  {    // Parse a key=value pair.    int pos = 0, length;    char* token;    if (string_next_token(argv[i], "=", &pos, &token, &length))    {      // We found a key with an '=' after it. What's the value?      char key[length+1];      strncpy(key, token, length);      key[length] = '/0';      if (string_next_token(argv[i], "=", &pos, &token, &length))      {        char value[length+1];        strncpy(value, token, length);        value[length] = '/0';        options_set(o, key, value);      }    }    // Next!    ++i;  }  argv_singleton = o;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:45,


示例22: fulltextConnect

/* Current interface:** argv[0] - module name** argv[1] - database name** argv[2] - table name** argv[3] - tokenizer name (optional, a sensible default is provided)** argv[4..] - passed to tokenizer (optional based on tokenizer)**/static int fulltextConnect(sqlite3 *db, void *pAux, int argc, char **argv,                           sqlite3_vtab **ppVTab){  int rc;  fulltext_vtab *v;  sqlite3_tokenizer_module *m = NULL;  assert( argc>=3 );  v = (fulltext_vtab *) malloc(sizeof(fulltext_vtab));  /* sqlite will initialize v->base */  v->db = db;  v->zName = string_dup(argv[2]);  v->pTokenizer = NULL;  if( argc==3 ){    get_simple_tokenizer_module(&m);  } else {    /* TODO(shess) For now, add new tokenizers as else if clauses. */    if( !strcmp(argv[3], "simple") ){      get_simple_tokenizer_module(&m);    } else {      assert( "unrecognized tokenizer"==NULL );    }  }  /* TODO(shess) Since tokenization impacts the index, the parameters  ** to the tokenizer need to be identical when a persistent virtual  ** table is re-created.  One solution would be a meta-table to track  ** such information in the database.  Then we could verify that the  ** information is identical on subsequent creates.  */  /* TODO(shess) Why isn't argv already (const char **)? */  rc = m->xCreate(argc-3, (const char **) (argv+3), &v->pTokenizer);  if( rc!=SQLITE_OK ) return rc;  v->pTokenizer->pModule = m;  /* TODO: verify the existence of backing tables foo_content, foo_term */  rc = sqlite3_declare_vtab(db, "create table x(content text)");  if( rc!=SQLITE_OK ) return rc;  memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));  *ppVTab = &v->base;  return SQLITE_OK;}
开发者ID:bhanug,项目名称:likewise-open,代码行数:52,


示例23: str_len

struct String *string_to_struct(char *str){  struct String *string;  int length;  char *dup_str;  length = str_len(str);  /* Value is the address of 1st element of space stored in memory for struct String */  string = malloc(sizeof(struct String));  /* Duplicate string and store its value to a variable */  dup_str = string_dup(str);  if(string == NULL) /* If function fails, return NULL */    return (NULL);  /* Pointer str accesses elements string and length w/its proper assigned value */  string->str = dup_str;  string->length = length;  /* Return address of structure (pointer to the string)*/  return (string);}
开发者ID:asaiapalacios,项目名称:holbertonschool-low_level_programming,代码行数:18,


示例24: fe_mesh_clone

fe_mesh_t* fe_mesh_clone(fe_mesh_t* mesh){  fe_mesh_t* copy = polymec_malloc(sizeof(fe_mesh_t));  copy->comm = mesh->comm;  copy->num_nodes = mesh->num_nodes;  copy->blocks = ptr_array_new();  for (int i = 0; i < mesh->blocks->size; ++i)    copy->blocks->data[i] = fe_block_clone(mesh->blocks->data[i]);  copy->block_names = string_array_new();  for (int i = 0; i < mesh->block_names->size; ++i)    copy->block_names->data[i] = string_dup(mesh->block_names->data[i]);  copy->block_elem_offsets = int_array_new();  for (int i = 0; i < mesh->block_elem_offsets->size; ++i)    int_array_append(copy->block_elem_offsets, mesh->block_elem_offsets->data[i]);  copy->node_coords = polymec_malloc(sizeof(point_t) * copy->num_nodes);  memcpy(copy->node_coords, mesh->node_coords, sizeof(point_t) * copy->num_nodes);  return copy;}
开发者ID:jjphatt,项目名称:polyglot-dev,代码行数:18,


示例25: st_func_from_func

st_func_t* st_func_from_func(const char* name, st_eval_func func,                              st_func_homogeneity_t homogeneity,                             st_func_constancy_t constancy,                             int num_comp){  ASSERT(func != NULL);  ASSERT(num_comp > 0);  st_func_t* f = GC_MALLOC(sizeof(st_func_t));  f->name = string_dup(name);  f->context = NULL;  f->vtable.eval = func;  f->homogeneous = (homogeneity == ST_FUNC_HOMOGENEOUS);  f->constant = (constancy == ST_FUNC_CONSTANT);  f->num_comp = num_comp;  memset(f->derivs, 0, sizeof(st_func_t*)*4);  GC_register_finalizer(f, &st_func_free, f, NULL, NULL);  return f;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:18,


示例26: str_grid_cell_solver_new

str_grid_cell_solver_t* str_grid_cell_solver_new(const char* solver_name,                                                 MPI_Comm comm,                                                 void* context,                                                 str_grid_cell_solver_vtable vtable,                                                 str_grid_t* grid,                                                 int num_comps){  ASSERT(vtable.solve != NULL);  ASSERT(num_comps > 0);  str_grid_cell_solver_t* solver = polymec_malloc(sizeof(str_grid_cell_solver_t));  solver->name = string_dup(solver_name);  solver->comm = comm;  solver->context = context;  solver->vtable = vtable;  solver->grid = grid;  solver->num_comps = num_comps;  return solver;}
开发者ID:polymec,项目名称:polyamri-dev,代码行数:18,


示例27: mcp_package_register

voidmcp_package_register(const char *pkgname, McpVer minver, McpVer maxver, McpPkg_CB callback,					 void *context, ContextCleanup_CB cleanup){	McpPkg *nu = (McpPkg *) malloc(sizeof(McpPkg));	nu->pkgname = string_dup(pkgname);	nu->minver = minver;	nu->maxver = maxver;	nu->callback = callback;	nu->context = context;	nu->cleanup = cleanup;	mcp_package_deregister(pkgname);	nu->next = mcp_PackageList;	mcp_PackageList = nu;	mcp_frame_package_renegotiate(pkgname);}
开发者ID:hyena,项目名称:fuzzball,代码行数:18,


示例28: st_func_from_sp_func

st_func_t* st_func_from_sp_func(sp_func_t* func){  ASSERT(func != NULL);  st_func_t* f = GC_MALLOC(sizeof(st_func_t));  f->name = string_dup(sp_func_name(func));  f->context = func;  f->vtable.eval = eval_sp_func;  f->homogeneous = sp_func_is_homogeneous(func);  f->constant = true;  f->num_comp = sp_func_num_comp(func);  memset(f->derivs, 0, sizeof(st_func_t*)*4);  for (int i = 1; i <= 4; ++i)  {    if (sp_func_has_deriv(func, i))      st_func_register_deriv(f, i, sp_func_deriv_new(func, i));  }  GC_register_finalizer(f, &st_func_free, f, NULL, NULL);  return f;}
开发者ID:drhansj,项目名称:polymec-dev,代码行数:19,


示例29: surface_gmls_functional_new

gmls_functional_t* surface_gmls_functional_new(const char* name,                                               void* context,                                               gmls_functional_vtable vtable,                                               int num_components,                                               surface_integral_t* quad_rule)            {  ASSERT(vtable.eval_integrands != NULL);  ASSERT(num_components > 0);  gmls_functional_t* functional = polymec_malloc(sizeof(gmls_functional_t));  functional->name = string_dup(name);  functional->context = context;  functional->vtable = vtable;  functional->num_comp = num_components;  functional->volume_quad_rule = NULL;  functional->surface_quad_rule = quad_rule;  return functional;}
开发者ID:jjphatt,项目名称:polywog-dev,代码行数:19,


示例30: make_indel_fragment

static indel_fragment * make_indel_fragment( const char * bases, uint32_t len ){    indel_fragment * res = malloc( sizeof * res );    if ( res != NULL )    {        res->bases = string_dup ( bases, len );        if ( res->bases == NULL )        {            free( res );            res = NULL;        }        else        {            res->len = len;            res->count = 1;        }    }    return res;}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:19,



注:本文中的string_dup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ string_duplicate函数代码示例
C++ string_copy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。