Mercurial > vim
comparison src/eval.c @ 357:25dd5036f2b0 v7.0092
updated for version 7.0092
author | vimboss |
---|---|
date | Fri, 24 Jun 2005 23:11:15 +0000 |
parents | 7033303ea0c0 |
children | 6c62b9b939bd |
comparison
equal
deleted
inserted
replaced
356:0f2b5d1b8117 | 357:25dd5036f2b0 |
---|---|
705 if (p->vv_flags & VV_COMPAT) | 705 if (p->vv_flags & VV_COMPAT) |
706 /* add to compat scope dict */ | 706 /* add to compat scope dict */ |
707 hash_add(&compat_hashtab, p->vv_di.di_key); | 707 hash_add(&compat_hashtab, p->vv_di.di_key); |
708 } | 708 } |
709 } | 709 } |
710 | |
711 #if defined(EXITFREE) || defined(PROTO) | |
712 void | |
713 eval_clear() | |
714 { | |
715 int i; | |
716 struct vimvar *p; | |
717 | |
718 for (i = 0; i < VV_LEN; ++i) | |
719 { | |
720 p = &vimvars[i]; | |
721 if (p->vv_di.di_tv.v_type == VAR_STRING) | |
722 vim_free(p->vv_di.di_tv.vval.v_string); | |
723 } | |
724 hash_clear(&vimvarht); | |
725 hash_clear(&compat_hashtab); | |
726 | |
727 /* script-local variables */ | |
728 for (i = 1; i <= ga_scripts.ga_len; ++i) | |
729 vars_clear(&SCRIPT_VARS(i)); | |
730 ga_clear(&ga_scripts); | |
731 | |
732 /* global variables */ | |
733 vars_clear(&globvarht); | |
734 } | |
735 #endif | |
710 | 736 |
711 /* | 737 /* |
712 * Return the name of the executed function. | 738 * Return the name of the executed function. |
713 */ | 739 */ |
714 char_u * | 740 char_u * |
16404 } | 16430 } |
16405 } | 16431 } |
16406 | 16432 |
16407 /* Add the line to the function. */ | 16433 /* Add the line to the function. */ |
16408 if (ga_grow(&newlines, 1) == FAIL) | 16434 if (ga_grow(&newlines, 1) == FAIL) |
16435 { | |
16436 vim_free(theline); | |
16409 goto erret; | 16437 goto erret; |
16438 } | |
16439 | |
16440 /* Copy the line to newly allocated memory. get_one_sourceline() | |
16441 * allocates 250 bytes per line, this saves 80% on average. The cost | |
16442 * is an extra alloc/free. */ | |
16443 p = vim_strsave(theline); | |
16444 if (p != NULL) | |
16445 { | |
16446 vim_free(theline); | |
16447 theline = p; | |
16448 } | |
16449 | |
16410 ((char_u **)(newlines.ga_data))[newlines.ga_len] = theline; | 16450 ((char_u **)(newlines.ga_data))[newlines.ga_len] = theline; |
16411 newlines.ga_len++; | 16451 newlines.ga_len++; |
16412 } | 16452 } |
16413 | 16453 |
16414 /* Don't define the function when skipping commands or when an error was | 16454 /* Don't define the function when skipping commands or when an error was |
16805 hi = hash_find(&func_hashtab, name); | 16845 hi = hash_find(&func_hashtab, name); |
16806 if (!HASHITEM_EMPTY(hi)) | 16846 if (!HASHITEM_EMPTY(hi)) |
16807 return HI2UF(hi); | 16847 return HI2UF(hi); |
16808 return NULL; | 16848 return NULL; |
16809 } | 16849 } |
16850 | |
16851 #if defined(EXITFREE) || defined(PROTO) | |
16852 void | |
16853 free_all_functions() | |
16854 { | |
16855 hashitem_T *hi; | |
16856 | |
16857 /* Need to start all over every time, because func_free() may change the | |
16858 * hash table. */ | |
16859 while (func_hashtab.ht_used > 0) | |
16860 for (hi = func_hashtab.ht_array; ; ++hi) | |
16861 if (!HASHITEM_EMPTY(hi)) | |
16862 { | |
16863 func_free(HI2UF(hi)); | |
16864 break; | |
16865 } | |
16866 } | |
16867 #endif | |
16810 | 16868 |
16811 /* | 16869 /* |
16812 * Return TRUE if a function "name" exists. | 16870 * Return TRUE if a function "name" exists. |
16813 */ | 16871 */ |
16814 static int | 16872 static int |