Commit Graph

14 Commits

Author SHA1 Message Date
Brandon Coleman
e69cfa6c15 move assert.h include out of vim.h 2014-07-09 00:18:19 +02:00
Brandon Coleman
bf219e1442 move <inttypes.h> include out of vim.h 2014-07-09 00:18:19 +02:00
Brandon Coleman
82b71a3056 move ascii.h include out of vim.h 2014-07-09 00:18:18 +02:00
Felipe Oliveira Carvalho
48fc1602be No OOM in hash_may_resize() and hash_add_item()
hash_add() can still return FAIL if the key already exists.
2014-06-16 01:31:35 -03:00
ZyX
70929f7e16 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.
2014-06-02 11:04:17 -03:00
Eliseo Martínez
f179081fc8 Remove long_u: hashtab: Enable clint: Add to clint.
- Add hashtab.[ch] to clint file.
- Fix clint errors.
2014-05-24 01:17:51 +02:00
Eliseo Martínez
0509556b93 Remove long_u: hashtab: Refactor other types.
Current type of some other parameters/variables can be improved:
- hashtab_T         : ht_error : int  -> bool.
- hash_clear_all()  : off      : int  -> unsigned int.
- hash_clear_all()  : todo     : long -> size_t.
- hash_may_resize() : todo     : int  -> size_t.
2014-05-24 01:17:49 +02:00
Eliseo Martínez
ec89761e8a Remove long_u: hashtab: Refactor long_u type.
hashtab.h:
- hash_T: long_u -> size_t.

  In principle, a hash value could thought of as just an unsigned number
  without size semantics (uint32_t or uint64_t).  But it is used as
  index at some places, and so, size_t is also eligible. Therea re some
  places where assignments occur between hash_T and size_t variables, in
  both directions. Therefore, if we define hash_T to be of a type having
  a different width than that of size_t, we will have an incorrect
  assignment somewhere that will require an assert/guard.  So the most
  sensible option here seems to do hast_T to be size_t too.

- hashtab_T.ht_mask: long_u -> hash_T.

  Masks are used to be combined with hash_T values, so they should be of
  the same type.

hashtab.c:
- hash_may_resize(): oldsize: long_u -> size_t.
- hash_may_resize(): newsize: long_u -> size_t.
- hash_may_resize(): newmask: long_u -> hash_T.
2014-05-24 01:17:47 +02:00
Eliseo Martínez
0c68623aca Remove long_u: hashtab: Enable -Wconversion.
- Add hashtab.c to converted files list.
- Fix conversion issues:
    * hash_lookup()     : idx      : unsigned -> hash_T.
    * hash_may_resize() : minitems : int      -> size_t.
    * hash_may_resize() : newi     : unsigned -> hash_T.
    * hash_may_resize() : minsize  : long_u   -> size_t.
2014-05-24 01:17:46 +02:00
Eliseo Martínez
4d97ae66f9 Remove long_u: hashtab: Cleanup: Others.
hashtab.h:
- Add missing includes.
- Move hash_T to the top and use it to define hashtab_T.
- Move hash_removed related definitions to the top, as they are used in
  the definition of hashtab_T.
- Reformat multiline expression (start continuation with operator).
- Reformat function declaration into one single line.

hashtab.c:
- Use C99 style variable declarations (move declarations as near to
  first-usage point as possible).
- Simplify oldarray/newarray computation.
- Simplify unneeded else branch.
- Remove redundant casts.
2014-05-24 01:17:45 +02:00
Eliseo Martínez
98255c7a78 Remove long_u: hashtab: Cleanup: Comments.
- Restyle comments (/// when appropiate, // otherwise).
- Improve comments (add new comments, augment/clarify existing ones).
2014-05-24 01:17:43 +02:00
Felipe Oliveira Carvalho
21784aeb00 Replace alloc() with xmalloc() and remove immediate OOM checks 2014-05-19 14:50:23 -03:00
Eliseo Martínez
409cc138f2 Introduce nvim namespace: Fix project-local includes.
Prepend 'nvim/' in all project-local (non-system) includes.
2014-05-15 20:46:01 +02:00
Eliseo Martínez
da51dc9cf2 Introduce nvim namespace: Move files.
Move files from src/ to src/nvim/.
- src/nvim/ becomes the new root dir for nvim executable sources.
- src/libnvim/ is planned to become root dir of the neovim library.
2014-05-15 20:46:01 +02:00