diff options
author | ZyX <kp-pav@ya.ru> | 2014-05-10 17:24:13 +0400 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:04:17 -0300 |
commit | 70929f7e1616bab2783cc5735c6061981cda8a0f (patch) | |
tree | 4a947af96fa0bac749f843a41e7b6593dd2659c0 /src/nvim/strings.c | |
parent | 880957ad4e3fc0ff681025f5e29c5eccf797c564 (diff) | |
download | rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.tar.gz rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.tar.bz2 rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.zip |
Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to
generated headers.
`ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI
This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.
Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r-- | src/nvim/strings.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 70fa43be2c..8c82186e15 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -43,7 +43,7 @@ /* * Copy "string" into newly allocated memory. */ -char_u *vim_strsave(char_u *string) +char_u *vim_strsave(char_u *string) FUNC_ATTR_NONNULL_RET { return (char_u *)xstrdup((char *)string); } @@ -54,7 +54,7 @@ char_u *vim_strsave(char_u *string) * The allocated memory always has size "len + 1", also when "string" is * shorter. */ -char_u *vim_strnsave(char_u *string, int len) +char_u *vim_strnsave(char_u *string, int len) FUNC_ATTR_NONNULL_RET { return (char_u *)strncpy(xmallocz(len), (char *)string, len); } @@ -487,9 +487,10 @@ int vim_isspace(int x) /* * Sort an array of strings. */ -static int -sort_compare(const void *s1, const void *s2); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "strings.c.generated.h" +#endif static int sort_compare(const void *s1, const void *s2) { return STRCMP(*(char **)s1, *(char **)s2); @@ -519,7 +520,7 @@ int has_non_ascii(char_u *s) * Concatenate two strings and return the result in allocated memory. * Returns NULL when out of memory. */ -char_u *concat_str(char_u *str1, char_u *str2) +char_u *concat_str(char_u *str1, char_u *str2) FUNC_ATTR_NONNULL_RET { size_t l = STRLEN(str1); char_u *dest = xmalloc(l + STRLEN(str2) + 1); |