comparison src/ex_getln.c @ 1412:45ba31f9ba0c v7.1.127

updated for version 7.1-127
author vimboss
date Sun, 30 Sep 2007 20:11:26 +0000
parents cdd82acd75b4
children bca50c9e1374
comparison
equal deleted inserted replaced
1411:0e6b369b9760 1412:45ba31f9ba0c
3314 * Do wildcard expansion on the string 'str'. 3314 * Do wildcard expansion on the string 'str'.
3315 * Chars that should not be expanded must be preceded with a backslash. 3315 * Chars that should not be expanded must be preceded with a backslash.
3316 * Return a pointer to alloced memory containing the new string. 3316 * Return a pointer to alloced memory containing the new string.
3317 * Return NULL for failure. 3317 * Return NULL for failure.
3318 * 3318 *
3319 * "orig" is the originally expanded string, copied to allocated memory. It
3320 * should either be kept in orig_save or freed. When "mode" is WILD_NEXT or
3321 * WILD_PREV "orig" should be NULL.
3322 *
3319 * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode" 3323 * Results are cached in xp->xp_files and xp->xp_numfiles, except when "mode"
3320 * is WILD_EXPAND_FREE or WILD_ALL. 3324 * is WILD_EXPAND_FREE or WILD_ALL.
3321 * 3325 *
3322 * mode = WILD_FREE: just free previously expanded matches 3326 * mode = WILD_FREE: just free previously expanded matches
3323 * mode = WILD_EXPAND_FREE: normal expansion, do not keep matches 3327 * mode = WILD_EXPAND_FREE: normal expansion, do not keep matches
3398 } 3402 }
3399 else 3403 else
3400 return NULL; 3404 return NULL;
3401 } 3405 }
3402 3406
3403 /* free old names */ 3407 /* free old names */
3404 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) 3408 if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST)
3405 { 3409 {
3406 FreeWild(xp->xp_numfiles, xp->xp_files); 3410 FreeWild(xp->xp_numfiles, xp->xp_files);
3407 xp->xp_numfiles = -1; 3411 xp->xp_numfiles = -1;
3408 vim_free(orig_save); 3412 vim_free(orig_save);
3538 } 3542 }
3539 } 3543 }
3540 3544
3541 if (mode == WILD_EXPAND_FREE || mode == WILD_ALL) 3545 if (mode == WILD_EXPAND_FREE || mode == WILD_ALL)
3542 ExpandCleanup(xp); 3546 ExpandCleanup(xp);
3547
3548 /* Free "orig" if it wasn't stored in "orig_save". */
3549 if (orig != orig_save)
3550 vim_free(orig);
3543 3551
3544 return ss; 3552 return ss;
3545 } 3553 }
3546 3554
3547 /* 3555 /*