comparison src/eval.c @ 3263:320cc46d0eb0 v7.3.400

updated for version 7.3.400 Problem: Compiler warnings for shadowed variables. Solution: Remove or rename the variables.
author Bram Moolenaar <bram@vim.org>
date Tue, 10 Jan 2012 22:26:17 +0100
parents 819322e0e93e
children 55cebc7e5de0
comparison
equal deleted inserted replaced
3262:373b8b5fee95 3263:320cc46d0eb0
6571 return (char_u *)ga.ga_data; 6571 return (char_u *)ga.ga_data;
6572 } 6572 }
6573 6573
6574 /* 6574 /*
6575 * Join list "l" into a string in "*gap", using separator "sep". 6575 * Join list "l" into a string in "*gap", using separator "sep".
6576 * When "echo" is TRUE use String as echoed, otherwise as inside a List. 6576 * When "echo_style" is TRUE use String as echoed, otherwise as inside a List.
6577 * Return FAIL or OK. 6577 * Return FAIL or OK.
6578 */ 6578 */
6579 static int 6579 static int
6580 list_join(gap, l, sep, echo, copyID) 6580 list_join(gap, l, sep, echo_style, copyID)
6581 garray_T *gap; 6581 garray_T *gap;
6582 list_T *l; 6582 list_T *l;
6583 char_u *sep; 6583 char_u *sep;
6584 int echo; 6584 int echo_style;
6585 int copyID; 6585 int copyID;
6586 { 6586 {
6587 int first = TRUE; 6587 int first = TRUE;
6588 char_u *tofree; 6588 char_u *tofree;
6589 char_u numbuf[NUMBUFLEN]; 6589 char_u numbuf[NUMBUFLEN];
6595 if (first) 6595 if (first)
6596 first = FALSE; 6596 first = FALSE;
6597 else 6597 else
6598 ga_concat(gap, sep); 6598 ga_concat(gap, sep);
6599 6599
6600 if (echo) 6600 if (echo_style)
6601 s = echo_string(&item->li_tv, &tofree, numbuf, copyID); 6601 s = echo_string(&item->li_tv, &tofree, numbuf, copyID);
6602 else 6602 else
6603 s = tv2string(&item->li_tv, &tofree, numbuf, copyID); 6603 s = tv2string(&item->li_tv, &tofree, numbuf, copyID);
6604 if (s != NULL) 6604 if (s != NULL)
6605 ga_concat(gap, s); 6605 ga_concat(gap, s);
17891 static void 17891 static void
17892 f_tr(argvars, rettv) 17892 f_tr(argvars, rettv)
17893 typval_T *argvars; 17893 typval_T *argvars;
17894 typval_T *rettv; 17894 typval_T *rettv;
17895 { 17895 {
17896 char_u *instr; 17896 char_u *in_str;
17897 char_u *fromstr; 17897 char_u *fromstr;
17898 char_u *tostr; 17898 char_u *tostr;
17899 char_u *p; 17899 char_u *p;
17900 #ifdef FEAT_MBYTE 17900 #ifdef FEAT_MBYTE
17901 int inlen; 17901 int inlen;
17908 #endif 17908 #endif
17909 char_u buf[NUMBUFLEN]; 17909 char_u buf[NUMBUFLEN];
17910 char_u buf2[NUMBUFLEN]; 17910 char_u buf2[NUMBUFLEN];
17911 garray_T ga; 17911 garray_T ga;
17912 17912
17913 instr = get_tv_string(&argvars[0]); 17913 in_str = get_tv_string(&argvars[0]);
17914 fromstr = get_tv_string_buf_chk(&argvars[1], buf); 17914 fromstr = get_tv_string_buf_chk(&argvars[1], buf);
17915 tostr = get_tv_string_buf_chk(&argvars[2], buf2); 17915 tostr = get_tv_string_buf_chk(&argvars[2], buf2);
17916 17916
17917 /* Default return value: empty string. */ 17917 /* Default return value: empty string. */
17918 rettv->v_type = VAR_STRING; 17918 rettv->v_type = VAR_STRING;
17934 ga_clear(&ga); 17934 ga_clear(&ga);
17935 return; 17935 return;
17936 } 17936 }
17937 17937
17938 /* fromstr and tostr have to contain the same number of chars */ 17938 /* fromstr and tostr have to contain the same number of chars */
17939 while (*instr != NUL) 17939 while (*in_str != NUL)
17940 { 17940 {
17941 #ifdef FEAT_MBYTE 17941 #ifdef FEAT_MBYTE
17942 if (has_mbyte) 17942 if (has_mbyte)
17943 { 17943 {
17944 inlen = (*mb_ptr2len)(instr); 17944 inlen = (*mb_ptr2len)(in_str);
17945 cpstr = instr; 17945 cpstr = in_str;
17946 cplen = inlen; 17946 cplen = inlen;
17947 idx = 0; 17947 idx = 0;
17948 for (p = fromstr; *p != NUL; p += fromlen) 17948 for (p = fromstr; *p != NUL; p += fromlen)
17949 { 17949 {
17950 fromlen = (*mb_ptr2len)(p); 17950 fromlen = (*mb_ptr2len)(p);
17951 if (fromlen == inlen && STRNCMP(instr, p, inlen) == 0) 17951 if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0)
17952 { 17952 {
17953 for (p = tostr; *p != NUL; p += tolen) 17953 for (p = tostr; *p != NUL; p += tolen)
17954 { 17954 {
17955 tolen = (*mb_ptr2len)(p); 17955 tolen = (*mb_ptr2len)(p);
17956 if (idx-- == 0) 17956 if (idx-- == 0)
17965 break; 17965 break;
17966 } 17966 }
17967 ++idx; 17967 ++idx;
17968 } 17968 }
17969 17969
17970 if (first && cpstr == instr) 17970 if (first && cpstr == in_str)
17971 { 17971 {
17972 /* Check that fromstr and tostr have the same number of 17972 /* Check that fromstr and tostr have the same number of
17973 * (multi-byte) characters. Done only once when a character 17973 * (multi-byte) characters. Done only once when a character
17974 * of instr doesn't appear in fromstr. */ 17974 * of in_str doesn't appear in fromstr. */
17975 first = FALSE; 17975 first = FALSE;
17976 for (p = tostr; *p != NUL; p += tolen) 17976 for (p = tostr; *p != NUL; p += tolen)
17977 { 17977 {
17978 tolen = (*mb_ptr2len)(p); 17978 tolen = (*mb_ptr2len)(p);
17979 --idx; 17979 --idx;
17984 17984
17985 ga_grow(&ga, cplen); 17985 ga_grow(&ga, cplen);
17986 mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen); 17986 mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
17987 ga.ga_len += cplen; 17987 ga.ga_len += cplen;
17988 17988
17989 instr += inlen; 17989 in_str += inlen;
17990 } 17990 }
17991 else 17991 else
17992 #endif 17992 #endif
17993 { 17993 {
17994 /* When not using multi-byte chars we can do it faster. */ 17994 /* When not using multi-byte chars we can do it faster. */
17995 p = vim_strchr(fromstr, *instr); 17995 p = vim_strchr(fromstr, *in_str);
17996 if (p != NULL) 17996 if (p != NULL)
17997 ga_append(&ga, tostr[p - fromstr]); 17997 ga_append(&ga, tostr[p - fromstr]);
17998 else 17998 else
17999 ga_append(&ga, *instr); 17999 ga_append(&ga, *in_str);
18000 ++instr; 18000 ++in_str;
18001 } 18001 }
18002 } 18002 }
18003 18003
18004 /* add a terminating NUL */ 18004 /* add a terminating NUL */
18005 ga_grow(&ga, 1); 18005 ga_grow(&ga, 1);