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

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

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

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

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

示例1: config_get_video_driver_options

/** * config_get_video_driver_options: * * Get an enumerated list of all video driver names, separated by '|'. * * Returns: string listing of all video driver names, separated by '|'. **/const char* config_get_video_driver_options(void){   union string_list_elem_attr attr;   unsigned i;   char *options = NULL;   int options_len = 0;   struct string_list *options_l = string_list_new();   attr.i = 0;   if (!options_l)      return NULL;   for (i = 0; video_driver_find_handle(i); i++)   {      const char *opt = video_driver_find_ident(i);      options_len += strlen(opt) + 1;      string_list_append(options_l, opt, attr);   }   options = (char*)calloc(options_len, sizeof(char));   if (!options)   {      string_list_free(options_l);      options_l = NULL;      return NULL;   }   string_list_join_concat(options, options_len, options_l, "|");   string_list_free(options_l);   options_l = NULL;   return options;}
开发者ID:netux79,项目名称:RAvideoFixes,代码行数:43,


示例2: prepost_interpret

static intprepost_interpret(string_list_ty *result, const string_list_ty *args,    const expr_position_ty *pp, const struct opcode_context_ty *ocp){    size_t          j;    trace(("prepost/n"));    (void)ocp;    assert(result);    assert(args);    assert(args->nstrings);    if (args->nstrings < 3)    {        sub_context_ty  *scp;        scp = sub_context_new();        sub_var_set_string(scp, "Name", args->string[0]);        error_with_position        (            pp,            scp,            i18n("$name: requires two or more arguments")        );        sub_context_delete(scp);        return -1;    }    for (j = 3; j < args->nstrings; j++)    {        string_ty       *s;        s = str_cat_three(args->string[1], args->string[j], args->string[2]);        string_list_append(result, s);        str_free(s);    }    return 0;}
开发者ID:cglinden,项目名称:autocook,代码行数:36,


示例3: cmd_grep

//.........这里部分代码省略.........			     PARSE_OPT_NO_INTERNAL_HELP);	grep_commit_pattern_type(pattern_type_arg, &opt);	if (use_index && !startup_info->have_repository)		/* die the same way as if we did it at the beginning */		setup_git_directory();	/*	 * skip a -- separator; we know it cannot be	 * separating revisions from pathnames if	 * we haven't even had any patterns yet	 */	if (argc > 0 && !opt.pattern_list && !strcmp(argv[0], "--")) {		argv++;		argc--;	}	/* First unrecognized non-option token */	if (argc > 0 && !opt.pattern_list) {		append_grep_pattern(&opt, argv[0], "command line", 0,				    GREP_PATTERN);		argv++;		argc--;	}	if (show_in_pager == default_pager)		show_in_pager = git_pager(1);	if (show_in_pager) {		opt.color = 0;		opt.name_only = 1;		opt.null_following_name = 1;		opt.output_priv = &path_list;		opt.output = append_path;		string_list_append(&path_list, show_in_pager);		use_threads = 0;	}	if ((opt.binary & GREP_BINARY_NOMATCH))		use_threads = 0;	if (!opt.pattern_list)		die(_("no pattern given."));	if (!opt.fixed && opt.ignore_case)		opt.regflags |= REG_ICASE;	compile_grep_patterns(&opt);	/* Check revs and then paths */	for (i = 0; i < argc; i++) {		const char *arg = argv[i];		unsigned char sha1[20];		/* Is it a rev? */		if (!get_sha1(arg, sha1)) {			struct object *object = parse_object(sha1);			if (!object)				die(_("bad object %s"), arg);			add_object_array(object, arg, &list);			continue;		}		if (!strcmp(arg, "--")) {			i++;			seen_dashdash = 1;		}		break;	}#ifndef NO_PTHREADS
开发者ID:Gregg1,项目名称:git,代码行数:67,


示例4: handle_line

static int handle_line(char *line, struct merge_parents *merge_parents){	int i, len = strlen(line);	struct origin_data *origin_data;	char *src, *origin;	struct src_data *src_data;	struct string_list_item *item;	int pulling_head = 0;	unsigned char sha1[20];	if (len < 43 || line[40] != '/t')		return 1;	if (!prefixcmp(line + 41, "not-for-merge"))		return 0;	if (line[41] != '/t')		return 2;	i = get_sha1_hex(line, sha1);	if (i)		return 3;	if (!find_merge_parent(merge_parents, sha1, NULL))		return 0; /* subsumed by other parents */	origin_data = xcalloc(1, sizeof(struct origin_data));	hashcpy(origin_data->sha1, sha1);	if (line[len - 1] == '/n')		line[len - 1] = 0;	line += 42;	/*	 * At this point, line points at the beginning of comment e.g.	 * "branch 'frotz' of git://that/repository.git".	 * Find the repository name and point it with src.	 */	src = strstr(line, " of ");	if (src) {		*src = 0;		src += 4;		pulling_head = 0;	} else {		src = line;		pulling_head = 1;	}	item = unsorted_string_list_lookup(&srcs, src);	if (!item) {		item = string_list_append(&srcs, src);		item->util = xcalloc(1, sizeof(struct src_data));		init_src_data(item->util);	}	src_data = item->util;	if (pulling_head) {		origin = src;		src_data->head_status |= 1;	} else if (!prefixcmp(line, "branch ")) {		origin_data->is_local_branch = 1;		origin = line + 7;		string_list_append(&src_data->branch, origin);		src_data->head_status |= 2;	} else if (!prefixcmp(line, "tag ")) {		origin = line;		string_list_append(&src_data->tag, origin + 4);		src_data->head_status |= 2;	} else if (!prefixcmp(line, "remote-tracking branch ")) {		origin = line + strlen("remote-tracking branch ");		string_list_append(&src_data->r_branch, origin);		src_data->head_status |= 2;	} else {		origin = src;		string_list_append(&src_data->generic, line);		src_data->head_status |= 2;	}	if (!strcmp(".", src) || !strcmp(src, origin)) {		int len = strlen(origin);		if (origin[0] == '/'' && origin[len - 1] == '/'')			origin = xmemdupz(origin + 1, len - 2);	} else {		char *new_origin = xmalloc(strlen(origin) + strlen(src) + 5);		sprintf(new_origin, "%s of %s", origin, src);		origin = new_origin;	}	if (strcmp(".", src))		origin_data->is_local_branch = 0;	string_list_append(&origins, origin)->util = origin_data;	return 0;}
开发者ID:CCorreia,项目名称:git,代码行数:92,


示例5: git_format_config

static int git_format_config(const char *var, const char *value, void *cb){	if (!strcmp(var, "format.headers")) {		if (!value)			die(_("format.headers without value"));		add_header(value);		return 0;	}	if (!strcmp(var, "format.suffix"))		return git_config_string(&fmt_patch_suffix, var, value);	if (!strcmp(var, "format.to")) {		if (!value)			return config_error_nonbool(var);		string_list_append(&extra_to, value);		return 0;	}	if (!strcmp(var, "format.cc")) {		if (!value)			return config_error_nonbool(var);		string_list_append(&extra_cc, value);		return 0;	}	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff") ||	    !strcmp(var, "color.ui")) {		return 0;	}	if (!strcmp(var, "format.numbered")) {		if (value && !strcasecmp(value, "auto")) {			auto_number = 1;			return 0;		}		numbered = git_config_bool(var, value);		auto_number = auto_number && numbered;		return 0;	}	if (!strcmp(var, "format.attach")) {		if (value && *value)			default_attach = xstrdup(value);		else			default_attach = xstrdup(git_version_string);		return 0;	}	if (!strcmp(var, "format.thread")) {		if (value && !strcasecmp(value, "deep")) {			thread = THREAD_DEEP;			return 0;		}		if (value && !strcasecmp(value, "shallow")) {			thread = THREAD_SHALLOW;			return 0;		}		thread = git_config_bool(var, value) && THREAD_SHALLOW;		return 0;	}	if (!strcmp(var, "format.signoff")) {		do_signoff = git_config_bool(var, value);		return 0;	}	if (!strcmp(var, "format.signature"))		return git_config_string(&signature, var, value);	return git_log_config(var, value, cb);}
开发者ID:DavidGould,项目名称:git,代码行数:63,


示例6: RARCH_ERR

static struct string_list *compressed_7zip_file_list_new(      const char *path, const char* ext){   CFileInStream archiveStream;   CLookToRead lookStream;   CSzArEx db;   ISzAlloc allocImp;   ISzAlloc allocTempImp;   size_t temp_size             = 0;   struct string_list     *list = NULL;      /* These are the allocation routines - currently using     * the non-standard 7zip choices. */   allocImp.Alloc     = SzAlloc;   allocImp.Free      = SzFree;   allocTempImp.Alloc = SzAllocTemp;   allocTempImp.Free  = SzFreeTemp;   if (InFile_Open(&archiveStream.file, path))   {      RARCH_ERR("Could not open %s as 7z archive./n",path);      return NULL;   }   list = string_list_new();   if (!list)   {      File_Close(&archiveStream.file);      return NULL;   }   FileInStream_CreateVTable(&archiveStream);   LookToRead_CreateVTable(&lookStream, False);   lookStream.realStream = &archiveStream.s;   LookToRead_Init(&lookStream);   CrcGenerateTable();   SzArEx_Init(&db);   if (SzArEx_Open(&db, &lookStream.s, &allocImp, &allocTempImp) == SZ_OK)   {      uint32_t i;      struct string_list *ext_list = ext ? string_split(ext, "|"): NULL;      SRes res                     = SZ_OK;      uint16_t *temp               = NULL;      for (i = 0; i < db.db.NumFiles; i++)      {         union string_list_elem_attr attr;         char infile[PATH_MAX_LENGTH];         const char *file_ext         = NULL;         size_t                   len = 0;         bool supported_by_core       = false;         const CSzFileItem         *f = db.db.Files + i;         /* we skip over everything, which is a directory. */         if (f->IsDir)            continue;         len = SzArEx_GetFileNameUtf16(&db, i, NULL);         if (len > temp_size)         {            free(temp);            temp_size = len;            temp      = (uint16_t *)malloc(temp_size * sizeof(temp[0]));            if (temp == 0)            {               res = SZ_ERROR_MEM;               break;            }         }         SzArEx_GetFileNameUtf16(&db, i, temp);         res      = utf16_to_char_string(temp, infile, sizeof(infile))             ? SZ_OK : SZ_ERROR_FAIL;         file_ext = path_get_extension(infile);         if (string_list_find_elem_prefix(ext_list, ".", file_ext))            supported_by_core = true;         /*          * Currently we only support files without subdirs in the archives.          * Folders are not supported (differences between win and lin.          * Archives within archives should imho never be supported.          */         if (!supported_by_core)            continue;         attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE;         if (!string_list_append(list, infile, attr))         {            res = SZ_ERROR_MEM;            break;         }      }//.........这里部分代码省略.........
开发者ID:jwarby,项目名称:RetroArch,代码行数:101,


示例7: task_database_handler

static void task_database_handler(retro_task_t *task){   const char *name                 = NULL;   database_info_handle_t  *dbinfo  = NULL;   database_state_handle_t *dbstate = NULL;   db_handle_t *db                  = NULL;   if (!task)      goto task_finished;   db      = (db_handle_t*)task->state;   if (!db)      goto task_finished;   if (!db->scan_started)   {      db->scan_started = true;      if (!string_is_empty(db->fullpath))      {         if (db->is_directory)            db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task, db->show_hidden_files);         else            db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task);      }      task_free_title(task);      if (db->handle)         db->handle->status = DATABASE_STATUS_ITERATE_BEGIN;   }   dbinfo  = db->handle;   dbstate = &db->state;   if (!dbinfo || task_get_cancelled(task))      goto task_finished;   switch (dbinfo->status)   {      case DATABASE_STATUS_ITERATE_BEGIN:         if (dbstate && !dbstate->list)         {            if (!string_is_empty(db->content_database_path))               dbstate->list        = dir_list_new(                     db->content_database_path,                     "rdb", false,                     db->show_hidden_files,                     false, false);            /* If the scan path matches a database path exactly then             * save time by only processing that database. */            if (dbstate->list && db->is_directory)            {               size_t i;               char *dirname = NULL;               if (!string_is_empty(db->fullpath))                  dirname    = find_last_slash(db->fullpath) + 1;               if (!string_is_empty(dirname))               {                  for (i = 0; i < dbstate->list->size; i++)                  {                     const char *data = dbstate->list->elems[i].data;                     char *dbname     = NULL;                     bool strmatch    = false;                     char *dbpath     = strdup(data);                     path_remove_extension(dbpath);                     dbname         = find_last_slash(dbpath) + 1;                     strmatch       = strcasecmp(dbname, dirname) == 0;                     free(dbpath);                     if (strmatch)                     {                        struct string_list *single_list = string_list_new();                        string_list_append(single_list,                              data,                              dbstate->list->elems[i].attr);                        dir_list_free(dbstate->list);                        dbstate->list = single_list;                        break;                     }                  }               }            }         }         dbinfo->status = DATABASE_STATUS_ITERATE_START;         break;      case DATABASE_STATUS_ITERATE_START:         name = database_info_get_current_element_name(dbinfo);         task_database_cleanup_state(dbstate);         dbstate->list_index  = 0;         dbstate->entry_index = 0;         task_database_iterate_start(dbinfo, name);         break;//.........这里部分代码省略.........
开发者ID:DoctorGoat,项目名称:RetroArch_LibNX,代码行数:101,


示例8: argparse

static voidargparse(option_level_ty level){    option_number_ty type;    string_ty       *s;    sub_context_ty  *scp;    int             fingerprint_update;    type = -1;    fingerprint_update = 0;    switch (arglex())    {    case arglex_token_help:        if (level != OPTION_LEVEL_COMMAND_LINE)        {          not_in_env:            scp = sub_context_new();            sub_var_set(scp, "Name", "%s", arglex_value.alv_string);            fatal_intl(scp, i18n("may not use $name in environment variable"));            /* NOTREACHED */        }        help((char *)0, usage);        quit(0);    case arglex_token_version:        if (level != OPTION_LEVEL_COMMAND_LINE)            goto not_in_env;        version();        quit(0);    default:        break;    }    while (arglex_token != arglex_token_eoln)    {        switch (arglex_token)        {        default:            generic_argument(usage);            continue;        case arglex_token_include:            if (arglex() != arglex_token_string)            {                arg_needs_string(arglex_token_include, usage);                /* NOTREACHED */            }            s = str_from_c(arglex_value.alv_string);            string_list_append_unique(&option.o_search_path, s);            str_free(s);            break;        case arglex_token_reason:            type = OPTION_REASON;          normal_on:            if (option_already(type, level))            {              too_many:                arg_duplicate_cur(usage);                /* NOTREACHED */            }            option_set(type, level, 1);            break;        case arglex_token_reason_not:            type = OPTION_REASON;          normal_off:            if (option_already(type, level))                goto too_many;            option_set(type, level, 0);            break;        case arglex_token_cascade:            type = OPTION_CASCADE;            goto normal_on;        case arglex_token_cascade_not:            type = OPTION_CASCADE;            goto normal_off;        case arglex_token_disassemble:            type = OPTION_DISASSEMBLE;            goto normal_on;        case arglex_token_disassemble_not:            type = OPTION_DISASSEMBLE;            goto normal_off;        case arglex_token_tty:            type = OPTION_TERMINAL;            goto normal_on;        case arglex_token_tty_not:            type = OPTION_TERMINAL;            goto normal_off;        case arglex_token_precious:            type = OPTION_PRECIOUS;            goto normal_on;//.........这里部分代码省略.........
开发者ID:cglinden,项目名称:autocook,代码行数:101,


示例9: string_list_new

struct string_list *string_list_new_special(enum string_list_type type,      void *data, unsigned *len, size_t *list_size){   union string_list_elem_attr attr;   unsigned i;   core_info_list_t *core_info_list = NULL;   const core_info_t *core_info     = NULL;   struct string_list *s            = string_list_new();   if (!s || !len)      goto error;   attr.i = 0;   *len   = 0;   switch (type)   {      case STRING_LIST_MENU_DRIVERS:#ifdef HAVE_MENU         for (i = 0; menu_driver_find_handle(i); i++)         {            const char *opt  = menu_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;#endif      case STRING_LIST_CAMERA_DRIVERS:#ifdef HAVE_CAMERA         for (i = 0; camera_driver_find_handle(i); i++)         {            const char *opt  = camera_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;#endif      case STRING_LIST_LOCATION_DRIVERS:#ifdef HAVE_LOCATION         for (i = 0; location_driver_find_handle(i); i++)         {            const char *opt  = location_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(options_l, opt, attr);         }         break;#endif      case STRING_LIST_AUDIO_DRIVERS:         for (i = 0; audio_driver_find_handle(i); i++)         {            const char *opt  = audio_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;      case STRING_LIST_AUDIO_RESAMPLER_DRIVERS:         for (i = 0; audio_resampler_driver_find_handle(i); i++)         {            const char *opt  = audio_resampler_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;      case STRING_LIST_VIDEO_DRIVERS:         for (i = 0; video_driver_find_handle(i); i++)         {            const char *opt  = video_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;      case STRING_LIST_INPUT_DRIVERS:         for (i = 0; input_driver_find_handle(i); i++)         {            const char *opt  = input_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;      case STRING_LIST_INPUT_HID_DRIVERS:         for (i = 0; hid_driver_find_handle(i); i++)         {            const char *opt  = hid_driver_find_ident(i);            *len            += strlen(opt) + 1;            string_list_append(s, opt, attr);         }         break;      case STRING_LIST_INPUT_JOYPAD_DRIVERS:         for (i = 0; joypad_driver_find_handle(i); i++)         {            const char *opt  = joypad_driver_find_ident(i);            *len            += strlen(opt) + 1;//.........这里部分代码省略.........
开发者ID:Warriors-Blade,项目名称:RetroArch,代码行数:101,


示例10: rarch_init_savefile_paths

static void rarch_init_savefile_paths(void){   global_t *global = global_get_ptr();   event_command(EVENT_CMD_SAVEFILES_DEINIT);   global->savefiles = string_list_new();   rarch_assert(global->savefiles);   if (*global->subsystem)   {      /* For subsystems, we know exactly which RAM types are supported. */      unsigned i, j;      const struct retro_subsystem_info *info =         libretro_find_subsystem_info(               global->system.special, global->system.num_special,               global->subsystem);      /* We'll handle this error gracefully later. */      unsigned num_content = min(info ? info->num_roms : 0,            global->subsystem_fullpaths ?            global->subsystem_fullpaths->size : 0);      bool use_sram_dir = path_is_directory(global->savefile_dir);      for (i = 0; i < num_content; i++)      {         for (j = 0; j < info->roms[i].num_memory; j++)         {            union string_list_elem_attr attr;            char path[PATH_MAX_LENGTH], ext[32];            const struct retro_subsystem_memory_info *mem =               (const struct retro_subsystem_memory_info*)               &info->roms[i].memory[j];            snprintf(ext, sizeof(ext), ".%s", mem->extension);            if (use_sram_dir)            {               /* Redirect content fullpath to save directory. */               strlcpy(path, global->savefile_dir, sizeof(path));               fill_pathname_dir(path,                     global->subsystem_fullpaths->elems[i].data, ext,                     sizeof(path));            }            else            {               fill_pathname(path, global->subsystem_fullpaths->elems[i].data,                     ext, sizeof(path));            }            attr.i = mem->type;            string_list_append(global->savefiles, path, attr);         }      }      /* Let other relevant paths be inferred from the main SRAM location. */      if (!global->has_set_save_path)         fill_pathname_noext(global->savefile_name, global->basename, ".srm",               sizeof(global->savefile_name));      if (path_is_directory(global->savefile_name))      {         fill_pathname_dir(global->savefile_name, global->basename, ".srm",               sizeof(global->savefile_name));         RARCH_LOG("Redirecting save file to /"%s/"./n",               global->savefile_name);      }   }   else   {      char savefile_name_rtc[PATH_MAX_LENGTH];      union string_list_elem_attr attr;      attr.i = RETRO_MEMORY_SAVE_RAM;      string_list_append(global->savefiles, global->savefile_name, attr);      /* Infer .rtc save path from save ram path. */      attr.i = RETRO_MEMORY_RTC;      fill_pathname(savefile_name_rtc,            global->savefile_name, ".rtc", sizeof(savefile_name_rtc));      string_list_append(global->savefiles, savefile_name_rtc, attr);   }}
开发者ID:PCGeekBrain,项目名称:RetroArch,代码行数:84,


示例11: cmd_grep

//.........这里部分代码省略.........		if (fallback)			use_index = 0;		else			/* die the same way as if we did it at the beginning */			setup_git_directory();	}	/*	 * skip a -- separator; we know it cannot be	 * separating revisions from pathnames if	 * we haven't even had any patterns yet	 */	if (argc > 0 && !opt.pattern_list && !strcmp(argv[0], "--")) {		argv++;		argc--;	}	/* First unrecognized non-option token */	if (argc > 0 && !opt.pattern_list) {		append_grep_pattern(&opt, argv[0], "command line", 0,				    GREP_PATTERN);		argv++;		argc--;	}	if (show_in_pager == default_pager)		show_in_pager = git_pager(1);	if (show_in_pager) {		opt.color = 0;		opt.name_only = 1;		opt.null_following_name = 1;		opt.output_priv = &path_list;		opt.output = append_path;		string_list_append(&path_list, show_in_pager);	}	if (!opt.pattern_list)		die(_("no pattern given."));	/*	 * We have to find "--" in a separate pass, because its presence	 * influences how we will parse arguments that come before it.	 */	for (i = 0; i < argc; i++) {		if (!strcmp(argv[i], "--")) {			seen_dashdash = 1;			break;		}	}	/*	 * Resolve any rev arguments. If we have a dashdash, then everything up	 * to it must resolve as a rev. If not, then we stop at the first	 * non-rev and assume everything else is a path.	 */	allow_revs = use_index && !untracked;	for (i = 0; i < argc; i++) {		const char *arg = argv[i];		struct object_id oid;		struct object_context oc;		struct object *object;		if (!strcmp(arg, "--")) {			i++;			break;		}
开发者ID:SuguruTakahashi,项目名称:git,代码行数:67,


示例12: handle_line

static int handle_line(char *line){	int i, len = strlen(line);	unsigned char *sha1;	char *src, *origin;	struct src_data *src_data;	struct string_list_item *item;	int pulling_head = 0;	if (len < 43 || line[40] != '/t')		return 1;	if (!prefixcmp(line + 41, "not-for-merge"))		return 0;	if (line[41] != '/t')		return 2;	line[40] = 0;	sha1 = xmalloc(20);	i = get_sha1(line, sha1);	line[40] = '/t';	if (i)		return 3;	if (line[len - 1] == '/n')		line[len - 1] = 0;	line += 42;	src = strstr(line, " of ");	if (src) {		*src = 0;		src += 4;		pulling_head = 0;	} else {		src = line;		pulling_head = 1;	}	item = unsorted_string_list_lookup(&srcs, src);	if (!item) {		item = string_list_append(&srcs, src);		item->util = xcalloc(1, sizeof(struct src_data));		init_src_data(item->util);	}	src_data = item->util;	if (pulling_head) {		origin = src;		src_data->head_status |= 1;	} else if (!prefixcmp(line, "branch ")) {		origin = line + 7;		string_list_append(&src_data->branch, origin);		src_data->head_status |= 2;	} else if (!prefixcmp(line, "tag ")) {		origin = line;		string_list_append(&src_data->tag, origin + 4);		src_data->head_status |= 2;	} else if (!prefixcmp(line, "remote-tracking branch ")) {		origin = line + strlen("remote-tracking branch ");		string_list_append(&src_data->r_branch, origin);		src_data->head_status |= 2;	} else {		origin = src;		string_list_append(&src_data->generic, line);		src_data->head_status |= 2;	}	if (!strcmp(".", src) || !strcmp(src, origin)) {		int len = strlen(origin);		if (origin[0] == '/'' && origin[len - 1] == '/'')			origin = xmemdupz(origin + 1, len - 2);	} else {		char *new_origin = xmalloc(strlen(origin) + strlen(src) + 5);		sprintf(new_origin, "%s of %s", origin, src);		origin = new_origin;	}	string_list_append(&origins, origin)->util = sha1;	return 0;}
开发者ID:Barklad,项目名称:first_app,代码行数:80,


示例13: init_content_file

/** * init_content_file: * * Initializes and loads a content file for the currently * selected libretro core. * * global->content_is_init will be set to the return value * on exit. * * Returns : true if successful, otherwise false. **/bool init_content_file(void){   unsigned i;   union string_list_elem_attr attr;   bool ret                                   = false;   struct string_list *content                = NULL;   const struct retro_subsystem_info *special = NULL;   settings_t *settings                       = config_get_ptr();   rarch_system_info_t *system                = rarch_system_info_get_ptr();   global_t   *global                         = global_get_ptr();   global->temporary_content                  = string_list_new();   if (!global->temporary_content)      goto error;   if (*global->subsystem)   {      special = libretro_find_subsystem_info(system->special,            system->num_special, global->subsystem);      if (!special)      {         RARCH_ERR(               "Failed to find subsystem /"%s/" in libretro implementation./n",               global->subsystem);         goto error;      }      if (special->num_roms && !global->subsystem_fullpaths)      {         RARCH_ERR("libretro core requires special content, but none were provided./n");         goto error;      }      else if (special->num_roms && special->num_roms            != global->subsystem_fullpaths->size)      {         RARCH_ERR("libretro core requires %u content files for subsystem /"%s/", but %u content files were provided./n",               special->num_roms, special->desc,               (unsigned)global->subsystem_fullpaths->size);         goto error;      }      else if (!special->num_roms && global->subsystem_fullpaths            && global->subsystem_fullpaths->size)      {         RARCH_ERR("libretro core takes no content for subsystem /"%s/", but %u content files were provided./n",               special->desc,               (unsigned)global->subsystem_fullpaths->size);         goto error;      }   }   content = string_list_new();   attr.i = 0;   if (!content)      goto error;   if (*global->subsystem)   {      for (i = 0; i < global->subsystem_fullpaths->size; i++)      {         attr.i  = special->roms[i].block_extract;         attr.i |= special->roms[i].need_fullpath << 1;         attr.i |= special->roms[i].required << 2;         string_list_append(content,               global->subsystem_fullpaths->elems[i].data, attr);      }   }   else   {      attr.i  = system->info.block_extract;      attr.i |= system->info.need_fullpath << 1;      attr.i |= (!system->no_content) << 2;      string_list_append(content,            (global->inited.core.no_content && settings->core.set_supports_no_game_enable) ? "" : global->path.fullpath, attr);   }#ifdef HAVE_ZLIB   /* Try to extract all content we're going to load if appropriate. */   for (i = 0; i < content->size; i++)   {      const char *ext       = NULL;      const char *valid_ext = NULL;      /* Block extract check. */      if (content->elems[i].attr.i & 1)         continue;//.........这里部分代码省略.........
开发者ID:blakekohler,项目名称:RetroArch,代码行数:101,


示例14: load_content_need_fullpath

static bool load_content_need_fullpath(      struct retro_game_info *info, unsigned i,      struct string_list* additional_path_allocs,      bool need_fullpath, const char *path){#ifdef HAVE_COMPRESSION   ssize_t len;   union string_list_elem_attr attributes;   char new_path[PATH_MAX_LENGTH]    = {0};   char new_basedir[PATH_MAX_LENGTH] = {0};   bool ret                          = false;   settings_t *settings              = config_get_ptr();   global_t   *global                = global_get_ptr();   rarch_system_info_t      *sys_info= rarch_system_info_get_ptr();   if (sys_info && sys_info->info.block_extract)      return true;   if (!need_fullpath)      return true;   if (!path_contains_compressed_file(path))      return true;   RARCH_LOG("Compressed file in case of need_fullpath."         "Now extracting to temporary directory./n");   strlcpy(new_basedir, settings->extraction_directory,         sizeof(new_basedir));   if ((!strcmp(new_basedir, "")) ||         !path_is_directory(new_basedir))   {      RARCH_WARN("Tried extracting to extraction directory, but "            "extraction directory was not set or found. "            "Setting extraction directory to directory "            "derived by basename.../n");      fill_pathname_basedir(new_basedir, path,            sizeof(new_basedir));   }   attributes.i = 0;   fill_pathname_join(new_path, new_basedir,         path_basename(path), sizeof(new_path));   ret = read_compressed_file(path,NULL,new_path, &len);   if (!ret || len < 0)   {      RARCH_ERR("%s /"%s/"./n",            msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE),            path);      return false;   }   string_list_append(additional_path_allocs,new_path, attributes);   info[i].path =      additional_path_allocs->elems      [additional_path_allocs->size -1 ].data;   /* global->temporary_content is initialized in init_content_file    * The following part takes care of cleanup of the unzipped files    * after exit.    */   rarch_assert(global->temporary_content != NULL);   string_list_append(global->temporary_content,         new_path, attributes);#endif   return true;}
开发者ID:blakekohler,项目名称:RetroArch,代码行数:71,


示例15: list_config_help

void list_config_help(int for_human){	struct slot_expansion slot_expansions[] = {		{ "advice", "*", list_config_advices },		{ "color.branch", "<slot>", list_config_color_branch_slots },		{ "color.decorate", "<slot>", list_config_color_decorate_slots },		{ "color.diff", "<slot>", list_config_color_diff_slots },		{ "color.grep", "<slot>", list_config_color_grep_slots },		{ "color.interactive", "<slot>", list_config_color_interactive_slots },		{ "color.status", "<slot>", list_config_color_status_slots },		{ "fsck", "<msg-id>", list_config_fsck_msg_ids },		{ "receive.fsck", "<msg-id>", list_config_fsck_msg_ids },		{ NULL, NULL, NULL }	};	const char **p;	struct slot_expansion *e;	struct string_list keys = STRING_LIST_INIT_DUP;	int i;	for (p = config_name_list; *p; p++) {		const char *var = *p;		struct strbuf sb = STRBUF_INIT;		for (e = slot_expansions; e->prefix; e++) {			strbuf_reset(&sb);			strbuf_addf(&sb, "%s.%s", e->prefix, e->placeholder);			if (!strcasecmp(var, sb.buf)) {				e->fn(&keys, e->prefix);				e->found++;				break;			}		}		strbuf_release(&sb);		if (!e->prefix)			string_list_append(&keys, var);	}	for (e = slot_expansions; e->prefix; e++)		if (!e->found)			BUG("slot_expansion %s.%s is not used",			    e->prefix, e->placeholder);	string_list_sort(&keys);	for (i = 0; i < keys.nr; i++) {		const char *var = keys.items[i].string;		const char *wildcard, *tag, *cut;		if (for_human) {			puts(var);			continue;		}		wildcard = strchr(var, '*');		tag = strchr(var, '<');		if (!wildcard && !tag) {			puts(var);			continue;		}		if (wildcard && !tag)			cut = wildcard;		else if (!wildcard && tag)			cut = tag;		else			cut = wildcard < tag ? wildcard : tag;		/*		 * We may produce duplicates, but that's up to		 * git-completion.bash to handle		 */		printf("%.*s/n", (int)(cut - var), var);	}	string_list_clear(&keys, 0);}
开发者ID:cEngineGit,项目名称:git,代码行数:76,


示例16: main

int main(int argc, char **argv){	int listen_port = 0;	struct string_list listen_addr = STRING_LIST_INIT_NODUP;	int serve_mode = 0, inetd_mode = 0;	const char *pid_file = NULL, *user_name = NULL, *group_name = NULL;	int detach = 0;	struct credentials *cred = NULL;	int i;	git_setup_gettext();	git_extract_argv0_path(argv[0]);	for (i = 1; i < argc; i++) {		char *arg = argv[i];		if (!prefixcmp(arg, "--listen=")) {			string_list_append(&listen_addr, xstrdup_tolower(arg + 9));			continue;		}		if (!prefixcmp(arg, "--port=")) {			char *end;			unsigned long n;			n = strtoul(arg+7, &end, 0);			if (arg[7] && !*end) {				listen_port = n;				continue;			}		}		if (!strcmp(arg, "--serve")) {			serve_mode = 1;			continue;		}		if (!strcmp(arg, "--inetd")) {			inetd_mode = 1;			log_syslog = 1;			continue;		}		if (!strcmp(arg, "--verbose")) {			verbose = 1;			continue;		}		if (!strcmp(arg, "--syslog")) {			log_syslog = 1;			continue;		}		if (!strcmp(arg, "--export-all")) {			export_all_trees = 1;			continue;		}		if (!prefixcmp(arg, "--access-hook=")) {			access_hook = arg + 14;			continue;		}		if (!prefixcmp(arg, "--timeout=")) {			timeout = atoi(arg+10);			continue;		}		if (!prefixcmp(arg, "--init-timeout=")) {			init_timeout = atoi(arg+15);			continue;		}		if (!prefixcmp(arg, "--max-connections=")) {			max_connections = atoi(arg+18);			if (max_connections < 0)				max_connections = 0;	        /* unlimited */			continue;		}		if (!strcmp(arg, "--strict-paths")) {			strict_paths = 1;			continue;		}		if (!prefixcmp(arg, "--base-path=")) {			base_path = arg+12;			continue;		}		if (!strcmp(arg, "--base-path-relaxed")) {			base_path_relaxed = 1;			continue;		}		if (!prefixcmp(arg, "--interpolated-path=")) {			interpolated_path = arg+20;			continue;		}		if (!strcmp(arg, "--reuseaddr")) {			reuseaddr = 1;			continue;		}		if (!strcmp(arg, "--user-path")) {			user_path = "";			continue;		}		if (!prefixcmp(arg, "--user-path=")) {			user_path = arg + 12;			continue;		}		if (!prefixcmp(arg, "--pid-file=")) {			pid_file = arg + 11;			continue;//.........这里部分代码省略.........
开发者ID:00027jang27,项目名称:git,代码行数:101,


示例17: cmd_clone

//.........这里部分代码省略.........	}	atexit(remove_junk);	sigchain_push_common(remove_junk_on_signal);	if (!option_bare) {		if (safe_create_leading_directories_const(work_tree) < 0)			die_errno(_("could not create leading directories of '%s'"),				  work_tree);		if (!dest_exists && mkdir(work_tree, 0777))			die_errno(_("could not create work tree dir '%s'"),				  work_tree);		junk_work_tree = work_tree;		set_git_work_tree(work_tree);	}	junk_git_dir = real_git_dir ? real_git_dir : git_dir;	if (safe_create_leading_directories_const(git_dir) < 0)		die(_("could not create leading directories of '%s'"), git_dir);	if (0 <= option_verbosity) {		if (option_bare)			fprintf(stderr, _("Cloning into bare repository '%s'.../n"), dir);		else			fprintf(stderr, _("Cloning into '%s'.../n"), dir);	}	if (option_recursive) {		if (option_required_reference.nr &&		    option_optional_reference.nr)			die(_("clone --recursive is not compatible with "			      "both --reference and --reference-if-able"));		else if (option_required_reference.nr) {			string_list_append(&option_config,				"submodule.alternateLocation=superproject");			string_list_append(&option_config,				"submodule.alternateErrorStrategy=die");		} else if (option_optional_reference.nr) {			string_list_append(&option_config,				"submodule.alternateLocation=superproject");			string_list_append(&option_config,				"submodule.alternateErrorStrategy=info");		}	}	init_db(git_dir, real_git_dir, option_template, INIT_DB_QUIET);	if (real_git_dir)		git_dir = real_git_dir;	write_config(&option_config);	git_config(git_default_config, NULL);	if (option_bare) {		if (option_mirror)			src_ref_prefix = "refs/";		strbuf_addstr(&branch_top, src_ref_prefix);		git_config_set("core.bare", "true");	} else {		strbuf_addf(&branch_top, "refs/remotes/%s/", option_origin);	}	strbuf_addf(&value, "+%s*:%s*", src_ref_prefix, branch_top.buf);	strbuf_addf(&key, "remote.%s.url", option_origin);
开发者ID:dindinw,项目名称:git,代码行数:67,


示例18: cmd_fetch_pack

int cmd_fetch_pack(int argc, const char **argv, const char *prefix){	int i, ret;	struct ref *ref = NULL;	const char *dest = NULL;	struct ref **sought = NULL;	int nr_sought = 0, alloc_sought = 0;	int fd[2];	char *pack_lockfile = NULL;	char **pack_lockfile_ptr = NULL;	struct child_process *conn;	struct fetch_pack_args args;	struct oid_array shallow = OID_ARRAY_INIT;	struct string_list deepen_not = STRING_LIST_INIT_DUP;	struct packet_reader reader;	enum protocol_version version;	fetch_if_missing = 0;	packet_trace_identity("fetch-pack");	memset(&args, 0, sizeof(args));	args.uploadpack = "git-upload-pack";	for (i = 1; i < argc && *argv[i] == '-'; i++) {		const char *arg = argv[i];		if (skip_prefix(arg, "--upload-pack=", &arg)) {			args.uploadpack = arg;			continue;		}		if (skip_prefix(arg, "--exec=", &arg)) {			args.uploadpack = arg;			continue;		}		if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) {			args.quiet = 1;			continue;		}		if (!strcmp("--keep", arg) || !strcmp("-k", arg)) {			args.lock_pack = args.keep_pack;			args.keep_pack = 1;			continue;		}		if (!strcmp("--thin", arg)) {			args.use_thin_pack = 1;			continue;		}		if (!strcmp("--include-tag", arg)) {			args.include_tag = 1;			continue;		}		if (!strcmp("--all", arg)) {			args.fetch_all = 1;			continue;		}		if (!strcmp("--stdin", arg)) {			args.stdin_refs = 1;			continue;		}		if (!strcmp("--diag-url", arg)) {			args.diag_url = 1;			continue;		}		if (!strcmp("-v", arg)) {			args.verbose = 1;			continue;		}		if (skip_prefix(arg, "--depth=", &arg)) {			args.depth = strtol(arg, NULL, 0);			continue;		}		if (skip_prefix(arg, "--shallow-since=", &arg)) {			args.deepen_since = xstrdup(arg);			continue;		}		if (skip_prefix(arg, "--shallow-exclude=", &arg)) {			string_list_append(&deepen_not, arg);			continue;		}		if (!strcmp(arg, "--deepen-relative")) {			args.deepen_relative = 1;			continue;		}		if (!strcmp("--no-progress", arg)) {			args.no_progress = 1;			continue;		}		if (!strcmp("--stateless-rpc", arg)) {			args.stateless_rpc = 1;			continue;		}		if (!strcmp("--lock-pack", arg)) {			args.lock_pack = 1;			pack_lockfile_ptr = &pack_lockfile;			continue;		}		if (!strcmp("--check-self-contained-and-connected", arg)) {			args.check_self_contained_and_connected = 1;			continue;//.........这里部分代码省略.........
开发者ID:Noffica,项目名称:git,代码行数:101,


示例19: pp_user_info

void pp_user_info(struct pretty_print_context *pp,		  const char *what, struct strbuf *sb,		  const char *line, const char *encoding){	struct ident_split ident;	char *line_end;	const char *mailbuf, *namebuf;	size_t namelen, maillen;	int max_length = 78; /* per rfc2822 */	if (pp->fmt == CMIT_FMT_ONELINE)		return;	line_end = strchrnul(line, '/n');	if (split_ident_line(&ident, line, line_end - line))		return;	mailbuf = ident.mail_begin;	maillen = ident.mail_end - ident.mail_begin;	namebuf = ident.name_begin;	namelen = ident.name_end - ident.name_begin;	if (pp->mailmap)		map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen);	if (pp->fmt == CMIT_FMT_EMAIL) {		if (pp->from_ident && ident_cmp(pp->from_ident, &ident)) {			struct strbuf buf = STRBUF_INIT;			strbuf_addstr(&buf, "From: ");			strbuf_add(&buf, namebuf, namelen);			strbuf_addstr(&buf, " <");			strbuf_add(&buf, mailbuf, maillen);			strbuf_addstr(&buf, ">/n");			string_list_append(&pp->in_body_headers,					   strbuf_detach(&buf, NULL));			mailbuf = pp->from_ident->mail_begin;			maillen = pp->from_ident->mail_end - mailbuf;			namebuf = pp->from_ident->name_begin;			namelen = pp->from_ident->name_end - namebuf;		}		strbuf_addstr(sb, "From: ");		if (needs_rfc2047_encoding(namebuf, namelen, RFC2047_ADDRESS)) {			add_rfc2047(sb, namebuf, namelen,				    encoding, RFC2047_ADDRESS);			max_length = 76; /* per rfc2047 */		} else if (needs_rfc822_quoting(namebuf, namelen)) {			struct strbuf quoted = STRBUF_INIT;			add_rfc822_quoted(&quoted, namebuf, namelen);			strbuf_add_wrapped_bytes(sb, quoted.buf, quoted.len,							-6, 1, max_length);			strbuf_release(&quoted);		} else {			strbuf_add_wrapped_bytes(sb, namebuf, namelen,						 -6, 1, max_length);		}		if (max_length <		    last_line_length(sb) + strlen(" <") + maillen + strlen(">"))			strbuf_addch(sb, '/n');		strbuf_addf(sb, " <%.*s>/n", (int)maillen, mailbuf);	} else {		strbuf_addf(sb, "%s: %.*s%.*s <%.*s>/n", what,			    (pp->fmt == CMIT_FMT_FULLER) ? 4 : 0, "    ",			    (int)namelen, namebuf, (int)maillen, mailbuf);	}	switch (pp->fmt) {	case CMIT_FMT_MEDIUM:		strbuf_addf(sb, "Date:   %s/n",			    show_ident_date(&ident, pp->date_mode));		break;	case CMIT_FMT_EMAIL:		strbuf_addf(sb, "Date: %s/n",			    show_ident_date(&ident, DATE_RFC2822));		break;	case CMIT_FMT_FULLER:		strbuf_addf(sb, "%sDate: %s/n", what,			    show_ident_date(&ident, pp->date_mode));		break;	default:		/* notin' */		break;	}}
开发者ID:CookieChen,项目名称:git,代码行数:87,


示例20: load_content_from_compressed_archive

static bool load_content_from_compressed_archive(      struct string_list *temporary_content,      struct retro_game_info *info, unsigned i,      struct string_list* additional_path_allocs,      bool need_fullpath, const char *path){   union string_list_elem_attr attributes;   ssize_t new_path_len;   char new_path[PATH_MAX_LENGTH];   char new_basedir[PATH_MAX_LENGTH];   bool ret                          = false;   settings_t *settings              = config_get_ptr();   rarch_system_info_t      *sys_info= NULL;   runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);   if (sys_info && sys_info->info.block_extract)      return true;   if (!need_fullpath || !path_contains_compressed_file(path))      return true;   RARCH_LOG("Compressed file in case of need_fullpath."         " Now extracting to temporary directory./n");   strlcpy(new_basedir, settings->cache_directory,         sizeof(new_basedir));   if (string_is_empty(new_basedir) || !path_is_directory(new_basedir))   {      RARCH_WARN("Tried extracting to cache directory, but "            "cache directory was not set or found. "            "Setting cache directory to directory "            "derived by basename.../n");      fill_pathname_basedir(new_basedir, path,            sizeof(new_basedir));   }   attributes.i = 0;   fill_pathname_join(new_path, new_basedir,         path_basename(path), sizeof(new_path));   ret = content_file_compressed_read(path, NULL, new_path, &new_path_len);   if (!ret || new_path_len < 0)   {      RARCH_ERR("%s /"%s/"./n",            msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE),            path);      return false;   }   RARCH_LOG("New path is: [%s]/n", new_path);   string_list_append(additional_path_allocs, new_path, attributes);   info[i].path =       additional_path_allocs->elems[additional_path_allocs->size -1 ].data;   if (!string_list_append(temporary_content, new_path, attributes))      return false;   return true;}
开发者ID:jwarby,项目名称:RetroArch,代码行数:62,


示例21: exclude_cb

static int exclude_cb(const struct option *opt, const char *arg, int unset){	struct string_list *exclude_list = opt->value;	string_list_append(exclude_list, arg);	return 0;}
开发者ID:Jinyan,项目名称:git,代码行数:6,


示例22: cmd_format_patch

//.........这里部分代码省略.........		list[nr - 1] = commit;	}	if (nr == 0)		/* nothing to do */		return 0;	total = nr;	if (!keep_subject && auto_number && total > 1)		numbered = 1;	if (numbered)		rev.total = total + start_number - 1;	if (cover_letter == -1) {		if (config_cover_letter == COVER_AUTO)			cover_letter = (total > 1);		else			cover_letter = (config_cover_letter == COVER_ON);	}	if (!signature) {		; /* --no-signature inhibits all signatures */	} else if (signature && signature != git_version_string) {		; /* non-default signature already set */	} else if (signature_file) {		struct strbuf buf = STRBUF_INIT;		if (strbuf_read_file(&buf, signature_file, 128) < 0)			die_errno(_("unable to read signature file '%s'"), signature_file);		signature = strbuf_detach(&buf, NULL);	}	if (in_reply_to || thread || cover_letter)		rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));	if (in_reply_to) {		const char *msgid = clean_message_id(in_reply_to);		string_list_append(rev.ref_message_ids, msgid);	}	rev.numbered_files = just_numbers;	rev.patch_suffix = fmt_patch_suffix;	if (cover_letter) {		if (thread)			gen_message_id(&rev, "cover");		make_cover_letter(&rev, use_stdout,				  origin, nr, list, branch_name, quiet);		total++;		start_number--;	}	rev.add_signoff = do_signoff;	while (0 <= --nr) {		int shown;		commit = list[nr];		rev.nr = total - nr + (start_number - 1);		/* Make the second and subsequent mails replies to the first */		if (thread) {			/* Have we already had a message ID? */			if (rev.message_id) {				/*				 * For deep threading: make every mail				 * a reply to the previous one, no				 * matter what other options are set.				 *				 * For shallow threading:				 *				 * Without --cover-letter and				 * --in-reply-to, make every mail a				 * reply to the one before.				 *				 * With --in-reply-to but no
开发者ID:AbelTian,项目名称:git,代码行数:67,


示例23: set_option

static int set_option(const char *name, const char *value){	if (!strcmp(name, "verbosity")) {		char *end;		int v = strtol(value, &end, 10);		if (value == end || *end)			return -1;		options.verbosity = v;		return 0;	}	else if (!strcmp(name, "progress")) {		if (!strcmp(value, "true"))			options.progress = 1;		else if (!strcmp(value, "false"))			options.progress = 0;		else			return -1;		return 0;	}	else if (!strcmp(name, "depth")) {		char *end;		unsigned long v = strtoul(value, &end, 10);		if (value == end || *end)			return -1;		options.depth = v;		return 0;	}	else if (!strcmp(name, "followtags")) {		if (!strcmp(value, "true"))			options.followtags = 1;		else if (!strcmp(value, "false"))			options.followtags = 0;		else			return -1;		return 0;	}	else if (!strcmp(name, "dry-run")) {		if (!strcmp(value, "true"))			options.dry_run = 1;		else if (!strcmp(value, "false"))			options.dry_run = 0;		else			return -1;		return 0;	}	else if (!strcmp(name, "check-connectivity")) {		if (!strcmp(value, "true"))			options.check_self_contained_and_connected = 1;		else if (!strcmp(value, "false"))			options.check_self_contained_and_connected = 0;		else			return -1;		return 0;	}	else if (!strcmp(name, "cas")) {		struct strbuf val = STRBUF_INIT;		strbuf_addf(&val, "--" CAS_OPT_NAME "=%s", value);		string_list_append(&cas_options, val.buf);		strbuf_release(&val);		return 0;	} else if (!strcmp(name, "cloning")) {		if (!strcmp(value, "true"))			options.cloning = 1;		else if (!strcmp(value, "false"))			options.cloning = 0;		else			return -1;		return 0;	} else if (!strcmp(name, "update-shallow")) {		if (!strcmp(value, "true"))			options.update_shallow = 1;		else if (!strcmp(value, "false"))			options.update_shallow = 0;		else			return -1;		return 0;	} else if (!strcmp(name, "pushcert")) {		if (!strcmp(value, "true"))			options.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;		else if (!strcmp(value, "false"))			options.push_cert = SEND_PACK_PUSH_CERT_NEVER;		else if (!strcmp(value, "if-asked"))			options.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED;		else			return -1;		return 0;#if LIBCURL_VERSION_NUM >= 0x070a08	} else if (!strcmp(name, "family")) {		if (!strcmp(value, "ipv4"))			git_curl_ipresolve = CURL_IPRESOLVE_V4;		else if (!strcmp(value, "ipv6"))			git_curl_ipresolve = CURL_IPRESOLVE_V6;		else if (!strcmp(value, "all"))			git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER;		else			return -1;		return 0;#endif /* LIBCURL_VERSION_NUM >= 0x070a08 */	} else {//.........这里部分代码省略.........
开发者ID:136357477,项目名称:git,代码行数:101,


示例24: shortlog

static void shortlog(const char *name,		     struct origin_data *origin_data,		     struct commit *head,		     struct rev_info *rev, int limit,		     struct strbuf *out){	int i, count = 0;	struct commit *commit;	struct object *branch;	struct string_list subjects = STRING_LIST_INIT_DUP;	struct string_list authors = STRING_LIST_INIT_DUP;	struct string_list committers = STRING_LIST_INIT_DUP;	int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;	struct strbuf sb = STRBUF_INIT;	const unsigned char *sha1 = origin_data->sha1;	branch = deref_tag(parse_object(sha1), sha1_to_hex(sha1), 40);	if (!branch || branch->type != OBJ_COMMIT)		return;	setup_revisions(0, NULL, rev, NULL);	add_pending_object(rev, branch, name);	add_pending_object(rev, &head->object, "^HEAD");	head->object.flags |= UNINTERESTING;	if (prepare_revision_walk(rev))		die("revision walk setup failed");	while ((commit = get_revision(rev)) != NULL) {		struct pretty_print_context ctx = {0};		if (commit->parents && commit->parents->next) {			/* do not list a merge but count committer */			record_person('c', &committers, commit);			continue;		}		if (!count)			/* the 'tip' committer */			record_person('c', &committers, commit);		record_person('a', &authors, commit);		count++;		if (subjects.nr > limit)			continue;		format_commit_message(commit, "%s", &sb, &ctx);		strbuf_ltrim(&sb);		if (!sb.len)			string_list_append(&subjects,					   sha1_to_hex(commit->object.sha1));		else			string_list_append(&subjects, strbuf_detach(&sb, NULL));	}	add_people_info(out, &authors, &committers);	if (count > limit)		strbuf_addf(out, "/n* %s: (%d commits)/n", name, count);	else		strbuf_addf(out, "/n* %s:/n", name);	if (origin_data->is_local_branch && use_branch_desc)		add_branch_desc(out, name);	for (i = 0; i < subjects.nr; i++)		if (i >= limit)			strbuf_addf(out, "  .../n");		else			strbuf_addf(out, "  %s/n", subjects.items[i].string);	clear_commit_marks((struct commit *)branch, flags);	clear_commit_marks(head, flags);	free_commit_list(rev->commits);	rev->commits = NULL;	rev->pending.nr = 0;	string_list_clear(&authors, 0);	string_list_clear(&committers, 0);	string_list_clear(&subjects, 0);}
开发者ID:CCorreia,项目名称:git,代码行数:77,


示例25: main

int main(int argc, char **argv){	int listen_port = 0;	struct string_list listen_addr = STRING_LIST_INIT_NODUP;	int inetd_mode = 0;	const char *pid_file = NULL, *user_name = NULL, *group_name = NULL;	int detach = 0;	struct passwd *pass = NULL;	struct group *group;	gid_t gid = 0;	int i;	git_extract_argv0_path(argv[0]);	for (i = 1; i < argc; i++) {		char *arg = argv[i];		if (!prefixcmp(arg, "--listen=")) {			string_list_append(&listen_addr, xstrdup_tolower(arg + 9));			continue;		}		if (!prefixcmp(arg, "--port=")) {			char *end;			unsigned long n;			n = strtoul(arg+7, &end, 0);			if (arg[7] && !*end) {				listen_port = n;				continue;			}		}		if (!strcmp(arg, "--inetd")) {			inetd_mode = 1;			log_syslog = 1;			continue;		}		if (!strcmp(arg, "--verbose")) {			verbose = 1;			continue;		}		if (!strcmp(arg, "--syslog")) {			log_syslog = 1;			continue;		}		if (!strcmp(arg, "--export-all")) {			export_all_trees = 1;			continue;		}		if (!prefixcmp(arg, "--timeout=")) {			timeout = atoi(arg+10);			continue;		}		if (!prefixcmp(arg, "--init-timeout=")) {			init_timeout = atoi(arg+15);			continue;		}		if (!prefixcmp(arg, "--max-connections=")) {			max_connections = atoi(arg+18);			if (max_connections < 0)				max_connections = 0;	        /* unlimited */			continue;		}		if (!strcmp(arg, "--strict-paths")) {			strict_paths = 1;			continue;		}		if (!prefixcmp(arg, "--base-path=")) {			base_path = arg+12;			continue;		}		if (!strcmp(arg, "--base-path-relaxed")) {			base_path_relaxed = 1;			continue;		}		if (!prefixcmp(arg, "--interpolated-path=")) {			interpolated_path = arg+20;			continue;		}		if (!strcmp(arg, "--reuseaddr")) {			reuseaddr = 1;			continue;		}		if (!strcmp(arg, "--user-path")) {			user_path = "";			continue;		}		if (!prefixcmp(arg, "--user-path=")) {			user_path = arg + 12;			continue;		}		if (!prefixcmp(arg, "--pid-file=")) {			pid_file = arg + 11;			continue;		}		if (!strcmp(arg, "--detach")) {			detach = 1;			log_syslog = 1;			continue;		}		if (!prefixcmp(arg, "--user=")) {			user_name = arg + 7;//.........这里部分代码省略.........
开发者ID:lilsexibabygirl,项目名称:git,代码行数:101,


示例26: cmd_format_patch

//.........这里部分代码省略.........		realstdout = xfdopen(xdup(1), "w");	if (prepare_revision_walk(&rev))		die("revision walk setup failed");	rev.boundary = 1;	while ((commit = get_revision(&rev)) != NULL) {		if (commit->object.flags & BOUNDARY) {			boundary_count++;			origin = (boundary_count == 1) ? commit : NULL;			continue;		}		/* ignore merges */		if (commit->parents && commit->parents->next)			continue;		if (ignore_if_in_upstream &&				has_commit_patch_id(commit, &ids))			continue;		nr++;		list = xrealloc(list, nr * sizeof(list[0]));		list[nr - 1] = commit;	}	total = nr;	if (!keep_subject && auto_number && total > 1)		numbered = 1;	if (numbered)		rev.total = total + start_number - 1;	if (in_reply_to || thread || cover_letter)		rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));	if (in_reply_to) {		const char *msgid = clean_message_id(in_reply_to);		string_list_append(msgid, rev.ref_message_ids);	}	rev.numbered_files = numbered_files;	rev.patch_suffix = fmt_patch_suffix;	if (cover_letter) {		if (thread)			gen_message_id(&rev, "cover");		make_cover_letter(&rev, use_stdout, numbered, numbered_files,				  origin, nr, list, head);		total++;		start_number--;	}	rev.add_signoff = add_signoff;	while (0 <= --nr) {		int shown;		commit = list[nr];		rev.nr = total - nr + (start_number - 1);		/* Make the second and subsequent mails replies to the first */		if (thread) {			/* Have we already had a message ID? */			if (rev.message_id) {				/*				 * For deep threading: make every mail				 * a reply to the previous one, no				 * matter what other options are set.				 *				 * For shallow threading:				 *				 * Without --cover-letter and				 * --in-reply-to, make every mail a				 * reply to the one before.				 *				 * With --in-reply-to but no
开发者ID:samv,项目名称:git,代码行数:67,


示例27: load_content

static bool load_content(const struct retro_subsystem_info *special,      const struct string_list *content){   unsigned i;   bool ret = true;   struct string_list* additional_path_allocs = string_list_new();   struct retro_game_info *info = (struct retro_game_info*)      calloc(content->size, sizeof(*info));   if (!info)      return false;   for (i = 0; i < content->size; i++)   {      const char *path = content->elems[i].data;      int attr = content->elems[i].attr.i;      bool need_fullpath = attr & 2;      bool require_content = attr & 4;      if (require_content && !*path)      {         RARCH_LOG("libretro core requires content, but nothing was provided./n");         ret = false;         goto end;      }      info[i].path = *path ? path : NULL;      if (!need_fullpath && *path)      {         /* Load the content into memory. */         RARCH_LOG("Loading content file: %s./n", path);         /* First content file is significant, attempt to do patching,          * CRC checking, etc. */         long size = i == 0 ?            read_content_file(path, (void**)&info[i].data) :            read_file(path, (void**)&info[i].data);         if (size < 0)         {            RARCH_ERR("Could not read content file /"%s/"./n", path);            ret = false;            goto end;         }         info[i].size = size;      }      else      {         RARCH_LOG("Content loading skipped. Implementation will"               " load it on its own./n");         if (need_fullpath && path_contains_compressed_file(path))         {            RARCH_LOG("Compressed file in case of need_fullpath."                  "Now extracting to temporary directory./n");            if ((!strcmp(g_settings.extraction_directory,"")) ||                 !path_is_directory(g_settings.extraction_directory))            {               RARCH_ERR("Tried extracting to extraction directory, but "                      "extraction directory was not set or found. Exiting./n");               rarch_assert(false);            }            char new_path[PATH_MAX];            union string_list_elem_attr attr;            attr.i = 0;            fill_pathname_join(new_path,g_settings.extraction_directory,                  path_basename(path),sizeof(new_path));            read_compressed_file(path,NULL,new_path);            string_list_append(additional_path_allocs,new_path,attr);            info[i].path =                  additional_path_allocs->elems                     [additional_path_allocs->size -1 ].data;         }      }   }   if (special)      ret = pretro_load_game_special(special->id, info, content->size);   else      ret = pretro_load_game(*content->elems[0].data ? info : NULL);   if (!ret)      RARCH_ERR("Failed to load game./n");end:   for (i = 0; i < content->size; i++)      free((void*)info[i].data);   string_list_free(additional_path_allocs);   free(info);   return ret;}
开发者ID:CyberShadow,项目名称:RetroArch,代码行数:97,


示例28: cook_auto_required

intcook_auto_required(void){    int             retval;    graph_ty        *gp;    graph_build_status_ty gb_status;    graph_walk_status_ty gw_status;    size_t          j;    /*     * This may have been explicitly forbidden on the command line.     */    if (!option_test(OPTION_INCLUDE_COOKED))        return 0;    retval = 0;    option_set(OPTION_ACTION, OPTION_LEVEL_AUTO, 1);    option_set(OPTION_TOUCH, OPTION_LEVEL_AUTO, 0);    option_set(OPTION_REASON, OPTION_LEVEL_COOKBOOK, 0);    /*     * Build the dependency graph.     */    gp = graph_new();    if    (        !option_test(OPTION_SILENT)    &&        option_test(OPTION_INCLUDE_COOKED_WARNING)    )        gp->file_pair = graph_file_pair_new(&cook_auto_list);    gb_status =        graph_build_list        (            gp,            &cook_auto_list,            graph_build_preference_error,            0   /* not primary, no up-to-date commentary */        );    if (option_test(OPTION_REASON))        graph_print_statistics(gp);    switch (gb_status)    {    case graph_build_status_error:        retval = -1;        break;    case graph_build_status_backtrack:        /* assert(0); */        retval = -1;        break;    case graph_build_status_success:        break;    }    /*     * Build a list of non-leaf cook-auto files.     */    string_list_destructor(&cook_auto_list_nonleaf);    for (j = 0; j < cook_auto_list.nstrings; ++j)    {        string_ty       *fn;        fn = cook_auto_list.string[j];        if (!graph_file_leaf_p(gp, fn))            string_list_append(&cook_auto_list_nonleaf, fn);    }    /*     * Walk the dependency graph.     */    if (retval == 0)    {        gw_status = graph_walk(gp);        switch (gw_status)        {        case graph_walk_status_uptodate:        case graph_walk_status_uptodate_done:            break;        case graph_walk_status_done:            retval = 1;            break;        case graph_walk_status_done_stop:        case graph_walk_status_wait:            assert(0);            /* fall through... */        case graph_walk_status_error:            retval = -1;            break;        }    }    /*     * Release any resources held by the graph.     *///.........这里部分代码省略.........
开发者ID:cglinden,项目名称:autocook,代码行数:101,


示例29: init_content_file

bool init_content_file(void){   unsigned i;   g_extern.temporary_content = string_list_new();   if (!g_extern.temporary_content)      return false;   const struct retro_subsystem_info *special = NULL;   if (*g_extern.subsystem)   {      special = libretro_find_subsystem_info(g_extern.system.special,            g_extern.system.num_special, g_extern.subsystem);      if (!special)      {         RARCH_ERR(               "Failed to find subsystem /"%s/" in libretro implementation./n",               g_extern.subsystem);         return false;      }      if (special->num_roms && !g_extern.subsystem_fullpaths)      {         RARCH_ERR("libretro core requires special content, but none were provided./n");         return false;      }      else if (special->num_roms && special->num_roms            != g_extern.subsystem_fullpaths->size)      {         RARCH_ERR("libretro core requires %u content files for subsystem /"%s/", but %u content files were provided./n",               special->num_roms, special->desc,               (unsigned)g_extern.subsystem_fullpaths->size);         return false;      }      else if (!special->num_roms && g_extern.subsystem_fullpaths            && g_extern.subsystem_fullpaths->size)      {         RARCH_ERR("libretro core takes no content for subsystem /"%s/", but %u content files were provided./n",               special->desc,               (unsigned)g_extern.subsystem_fullpaths->size);         return false;      }   }   union string_list_elem_attr attr;   attr.i = 0;   struct string_list *content = (struct string_list*)string_list_new();   if (!content)      return false;   if (*g_extern.subsystem)   {      for (i = 0; i < g_extern.subsystem_fullpaths->size; i++)      {         attr.i  = special->roms[i].block_extract;         attr.i |= special->roms[i].need_fullpath << 1;         attr.i |= special->roms[i].required << 2;         string_list_append(content,               g_extern.subsystem_fullpaths->elems[i].data, attr);      }   }   else   {      attr.i  = g_extern.system.info.block_extract;      attr.i |= g_extern.system.info.need_fullpath << 1;      attr.i |= (!g_extern.system.no_content) << 2;      string_list_append(content,            g_extern.libretro_no_content ? "" : g_extern.fullpath, attr);   }#ifdef HAVE_ZLIB   /* Try to extract all content we're going to load if appropriate. */   for (i = 0; i < content->size; i++)   {      /* Block extract check. */      if (content->elems[i].attr.i & 1)         continue;      const char *ext = path_get_extension(content->elems[i].data);      const char *valid_ext = special ?         special->roms[i].valid_extensions :         g_extern.system.info.valid_extensions;      if (ext && !strcasecmp(ext, "zip"))      {         char temporary_content[PATH_MAX];         strlcpy(temporary_content, content->elems[i].data,               sizeof(temporary_content));         if (!zlib_extract_first_content_file(temporary_content,                  sizeof(temporary_content), valid_ext,                  *g_settings.extraction_directory ?                  g_settings.extraction_directory : NULL))         {            RARCH_ERR("Failed to extract content from zipped file: %s./n",                  temporary_content);//.........这里部分代码省略.........
开发者ID:CyberShadow,项目名称:RetroArch,代码行数:101,



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


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