1. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  2. 20 Mar, 2017 1 commit
    • map: remove `*map_free` macros · 94af9155
      The `map_free` functions were not implemented as functions but instead
      as macros which also set the map to NULL. While this is most certainly
      sensible in most cases, we should prefer the more obvious behavior,
      namingly leaving the map pointer intact.
      
      Furthermore, this macro has been refactored incorrectly during the
      map-refactorings: the two statements are not actually grouped together
      by a `do { ... } while (0)` block, as it is required for macros to
      match the behavior of functions more closely. This has led to at least
      one subtle nesting error in `pack-objects.c`. The following code block
      
      ```
          if (pb->object_ix)
              git_oidmap_free(pb->object_ix);
      ```
      
      would be expanded to
      
      ```
          if (pb->object_ix)
              git_oidmap__free(pb->object_ix); pb->object_ix = NULL;
      ```
      
      which is not what one woudl expect. While it is not a bug here as it
      would simply become a no-op, the wrong implementation could lead to bugs
      in other occasions.
      
      Fix this by simply removing the macro altogether and replacing it with
      real function calls. This leaves the burden of setting the pointer to
      NULL afterwards to the caller, but this is actually expected and behaves
      like other `free` functions.
      Patrick Steinhardt committed
  3. 17 Feb, 2017 5 commits
  4. 15 Feb, 2015 1 commit
  5. 13 Feb, 2015 1 commit
  6. 11 Jan, 2013 1 commit