comparison src/tag.c @ 14301:3c80092eb211 v8.1.0166

patch 8.1.0166: using dict_add_nr_str() is clumsy commit https://github.com/vim/vim/commit/e0be167a805fd547c25ec1ec97fd4c7f13046236 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 8 16:50:37 2018 +0200 patch 8.1.0166: using dict_add_nr_str() is clumsy Problem: Using dict_add_nr_str() is clumsy. Solution: Split into two functions. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/3154)
author Christian Brabandt <cb@256bit.org>
date Sun, 08 Jul 2018 17:00:07 +0200
parents 4afe2386aae8
children 27b9a84395b5
comparison
equal deleted inserted replaced
14300:7a0639d9fdc8 14301:3c80092eb211
903 { 903 {
904 vim_free(dict); 904 vim_free(dict);
905 continue; 905 continue;
906 } 906 }
907 907
908 dict_add_nr_str(dict, "text", 0L, tag_name); 908 dict_add_string(dict, "text", tag_name);
909 dict_add_nr_str(dict, "filename", 0L, fname); 909 dict_add_string(dict, "filename", fname);
910 dict_add_nr_str(dict, "lnum", lnum, NULL); 910 dict_add_number(dict, "lnum", lnum);
911 if (lnum == 0) 911 if (lnum == 0)
912 dict_add_nr_str(dict, "pattern", 0L, cmd); 912 dict_add_string(dict, "pattern", cmd);
913 } 913 }
914 914
915 vim_snprintf((char *)IObuff, IOSIZE, "ltag %s", tag); 915 vim_snprintf((char *)IObuff, IOSIZE, "ltag %s", tag);
916 set_errorlist(curwin, list, ' ', IObuff, NULL); 916 set_errorlist(curwin, list, ' ', IObuff, NULL);
917 917
3921 if (len > MAXPATHL - 1) 3921 if (len > MAXPATHL - 1)
3922 len = MAXPATHL - 1; 3922 len = MAXPATHL - 1;
3923 vim_strncpy(buf, start, len); 3923 vim_strncpy(buf, start, len);
3924 } 3924 }
3925 buf[len] = NUL; 3925 buf[len] = NUL;
3926 retval = dict_add_nr_str(dict, field_name, 0L, buf); 3926 retval = dict_add_string(dict, field_name, buf);
3927 vim_free(buf); 3927 vim_free(buf);
3928 return retval; 3928 return retval;
3929 } 3929 }
3930 3930
3931 /* 3931 /*
3966 NULL) == FAIL 3966 NULL) == FAIL
3967 || add_tag_field(dict, "cmd", tp.command, 3967 || add_tag_field(dict, "cmd", tp.command,
3968 tp.command_end) == FAIL 3968 tp.command_end) == FAIL
3969 || add_tag_field(dict, "kind", tp.tagkind, 3969 || add_tag_field(dict, "kind", tp.tagkind,
3970 tp.tagkind_end) == FAIL 3970 tp.tagkind_end) == FAIL
3971 || dict_add_nr_str(dict, "static", is_static, NULL) == FAIL) 3971 || dict_add_number(dict, "static", is_static) == FAIL)
3972 ret = FAIL; 3972 ret = FAIL;
3973 3973
3974 vim_free(full_fname); 3974 vim_free(full_fname);
3975 3975
3976 if (tp.command_end != NULL) 3976 if (tp.command_end != NULL)