Commit Graph

8399 Commits

Author SHA1 Message Date
ZyX
84aa457ccd os/env: Fix “invalid pointer to local” false positive 2017-04-16 21:02:43 +03:00
ZyX
dc523eed8e fileio: Silence “!= identical subexpressions” warning 2017-04-16 20:59:58 +03:00
ZyX
0718d0e6d4 message: Some more has_mbyte/enc_utf8 removal 2017-04-16 20:58:19 +03:00
ZyX
083792e137 message: Remove some enc_utf8/… checks 2017-04-16 20:56:30 +03:00
ZyX
10ce00efa8 memline: Fix “NULL pointer dereference” warning
It was actually a false positive indicating always-true condition, not real 
dereference.
2017-04-16 20:55:29 +03:00
ZyX
2394c9f2b7 memline: Silence “buffer underflow” warning, looks like false positive 2017-04-16 20:47:06 +03:00
ZyX
0f7c260cd8 fileio: Simlify help files encoding detection
Most of code is dead when enc_utf8 is always true. Given that `c` is being 
reused for other purposes I left it set to 1 just in case.
2017-04-16 20:39:57 +03:00
ZyX
e3de83a829 hardcopy: Remove unneeded prt_do_conv assignment 2017-04-16 20:32:10 +03:00
ZyX
d88ae748b5 getchar: Fix if block indentation 2017-04-16 20:29:19 +03:00
ZyX
fe01e9c947 ex_docmd: Remove unneeded if() 2017-04-16 20:27:47 +03:00
ZyX
87e107d921 ex_docmd: Remove :Ni! easter egg 2017-04-16 20:27:20 +03:00
ZyX
a894c82def ex_docmd: Remove excessive assignment 2017-04-16 20:25:00 +03:00
ZyX
d766607dc9 farsi: Simplify condition 2017-04-16 20:24:30 +03:00
ZyX
c5010c98ae eval: Fix position of buf declaration 2017-04-16 20:22:58 +03:00
ZyX
1bc0800787 eval: Remove unneeded !eap->skip check
Already checked in the outer if().
2017-04-16 20:22:12 +03:00
ZyX
9dd1926df0 eval: Remove unneeded varp check 2017-04-16 20:20:53 +03:00
ZyX
9b1dd08425 eval: Remove unneeded varp check 2017-04-16 20:20:38 +03:00
ZyX
787d71a3af eval: Fix condition in f_serverstop 2017-04-16 20:19:10 +03:00
ZyX
fbdef2e6f2 eval: Refactor nr2char()
Adds error messages, checks type and ignores the second argument.

Currently utf_char2bytes is able to handle any 31-bit character, not
limited by a unicode range. So checking for INT_MAX and not for
something else: function yet uses `int`.
2017-04-16 20:16:55 +03:00
ZyX
3c5f4b382f eval: Silence octal constant warning 2017-04-16 20:08:56 +03:00
ZyX
31190879cc eval: Fix useless NULL check
partial_name() as it is written now really cannot return NULL
2017-04-16 20:07:54 +03:00
ZyX
7c9e3d6cad eval: Refactor f_char2nr
With has_mbyte equal to 1 and &encoding always UTF-8 second argument is no 
longer useful: utf_ptr2char is the same as mb_ptr2char.

Also changes function behaviour a bit: now if second argument is not a number it 
immediately returns with error, without bothering to get a character.
2017-04-16 20:02:06 +03:00
ZyX
97a1ccf8e7 eval: Fix V547: d == NULL was already checked at line 2986 2017-04-16 19:56:55 +03:00
ZyX
05c1829a8c eval: Silence eap->skip false positives
`lnum` starts at `eap->line2` in case of skipping, so cycle is always run at 
least once.
2017-04-16 19:55:49 +03:00
ZyX
d70a0f6895 eval/typval_encode: Silence then/else equivalence warning 2017-04-16 19:51:35 +03:00
ZyX
dd5b0cc17a edit: Copy assert to before the warning 2017-04-16 19:50:23 +03:00
ZyX
fb4754104b macros: Fix excessive check 2017-04-16 19:39:55 +03:00
ZyX
9e9ba14e0e edit: Fix strange code
Based on the flow it looks like ptr could not be NULL here: if ptr_arg is NULL 
ptr is compl_leader, if compl_leader is NULL function exits. This also applies 
to Vim as far as I see.
2017-04-16 19:38:16 +03:00
ZyX
4f0fc1f06a digraph: Fix errors due to has_mbyte and friends being fixed 2017-04-16 19:32:38 +03:00
ZyX
2901921a1b digraph: Ignore false positive
Reversed order is intentional, digraphs allow swapping characters.
2017-04-16 19:30:18 +03:00
ZyX
a096766ee3 diff: Silence -V519
Not exactly a false positive, but previous assignment is a part of the pattern 
“change global, run code which uses it, change global back”.
2017-04-16 19:27:17 +03:00
ZyX
33952a7661 *: Silence some false positives 2017-04-16 19:18:54 +03:00
Justin M. Keyes
77a4f8f235 Merge #6219 from jbradaric/vim-7.4.2170
vim-patch:7.4.{2170,2180,2240,2241,2242}
2017-04-16 16:49:14 +02:00
Nikolai Aleksandrovich Pavlov
d4c7f74ed1 Merge pull request #6493 from ZyX-I/pvs-script
[RFC] scripts: Create script which checks Neovim with PVS-studio
2017-04-16 03:03:38 +03:00
Justin M. Keyes
5c805f4566 Merge #6528 from ZyX-I/revise-malloc-attr
Revise places where FUNC_ATTR_MALLOC is present

Closes #6521
2017-04-15 22:12:31 +02:00
Jurica Bradaric
ec0fabd4d5 eval.c: Code style fixes 2017-04-15 18:48:06 +02:00
ZyX
d76a13bb65 os/shell: Remove FUNC_ATTR_MALLOC from shell_build_argv
Returns an array of allocated strings.
2017-04-15 19:39:53 +03:00
ZyX
ac47e64eca ops: Remove FUNC_ATTR_MALLOC from copy_register
Returned storage has a pointer to a newly allocated array.
2017-04-15 19:25:00 +03:00
ZyX
d191ba1db3 option: Remove FUNC_ATTR_MALLOC from get_winbuf_options
Same as tv_dict_alloc() and additionally it saves some strings inside 
a dictionary.
2017-04-15 19:23:00 +03:00
ZyX
82ba2891ae eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc_ret
Same as tv_list_alloc, but additionally ret_tv receives pointer to the newly 
allocated list.
2017-04-15 19:19:22 +03:00
ZyX
af3579d5f7 eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_alloc
Allocated dict points to previously allocated dict.
Queue in allocated dict points to itself.
Hashtab in allocated dict points to inside itself.
Allocated dict is saved to gc_first_dict.
2017-04-15 19:18:25 +03:00
ZyX
b9004d7448 eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_item_copy
Allocated storage may receive pointer to the list after tv_copy().
2017-04-15 19:16:40 +03:00
ZyX
b08b71c728 eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc
Allocated list points to previously allocated list.
Allocated list is saved to gc_first_list.
2017-04-15 19:16:00 +03:00
ZyX
0dddd8a27c os/fileio: Remove FUNC_ATTR_MALLOC for file_open_new
fp contains pointer to rbuffer
2017-04-15 19:13:43 +03:00
Björn Linse
c70ab1a2e2 test: make locale dependent oldtest more reliable (#6526) 2017-04-15 15:06:50 +02:00
James McCoy
a8f7872f44
test_timers.vim: Adjust timing to handle difference in implementation 2017-04-15 08:50:43 -04:00
Björn Linse
12fc1defd6 ops: fix i<c-r> with multi-byte text (#6524) 2017-04-15 11:19:40 +02:00
ZyX
c289986c89 eval/encode: Do translate “… argument” strings, but only in conv_error 2017-04-15 00:08:50 +03:00
ZyX
31fd6d4bbf eval/typval: Do not translate tv_clear argument, this is useless 2017-04-15 00:00:22 +03:00
ZyX
b54e5c220f unittests: Add a test for TV_CSTRING
Not using enum{} because SIZE_MAX exceeds integer and I do not really like how
enum definition is described in C99:

1. Even though all values must fit into the chosen type (6.7.2.2, p 4) the type
   to choose is still implementation-defined.
2. 6.4.4.3 explicitly states that “an identifier declared as an enumeration
   constant has type `int`”. So it looks like “no matter what type was chosen
   for enumeration, constants will be integers”. Yet the following simple
   program:

        #include <stdint.h>
        #include <stdio.h>
        #include <stddef.h>

        enum { X=SIZE_MAX };

        int main(int argc, char **argv)
        {
          printf("x:%zu m:%zu t:%zu v:%zu",
                 sizeof(X), sizeof(SIZE_MAX), sizeof(size_t), (size_t)X);
        }

    yields one of the following using different compilers:

    - clang/gcc/pathcc: `x:8 m:8 t:8 v:18446744073709551615`
    - pcc/tcc: `x:4 m:8 t:8 v:1844674407370955161`

    If I remove the cast of X to size_t then pcc/tcc both yield `x:4 m:8 t:8
    v:4294967295`, other compilers’ output does not change.

    All compilers were called with `$compiler -std=c99 -xc -` (feeding program
    from echo), except for `tcc` which has missing `-std=c99`. `pcc` seems to
    ignore the argument though: it is perfectly fine with `-std=c1000`.
2017-04-14 23:58:47 +03:00