<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/strmap.c, branch editorconfig</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>map: remove `*map_free` macros</title>
<updated>2017-03-20T08:01:18+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2017-03-20T08:01:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=94af9155cf908f402e07408d900177280c2e90bb'/>
<id>94af9155cf908f402e07408d900177280c2e90bb</id>
<content type='text'>
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-&gt;object_ix)
        git_oidmap_free(pb-&gt;object_ix);
```

would be expanded to

```
    if (pb-&gt;object_ix)
        git_oidmap__free(pb-&gt;object_ix); pb-&gt;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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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-&gt;object_ix)
        git_oidmap_free(pb-&gt;object_ix);
```

would be expanded to

```
    if (pb-&gt;object_ix)
        git_oidmap__free(pb-&gt;object_ix); pb-&gt;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.
</pre>
</div>
</content>
</entry>
<entry>
<title>strmap: remove GIT__USE_STRMAP macro</title>
<updated>2017-02-17T10:41:06+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2017-01-27T13:32:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=13c3bc9adf7c3e467c6d1a577859bf31d551022b'/>
<id>13c3bc9adf7c3e467c6d1a577859bf31d551022b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>strmap: convert macros to functions</title>
<updated>2017-02-17T10:41:06+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2017-01-27T13:13:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=a13cfd2af2aa2f9be660fc1c789405b5188b904d'/>
<id>a13cfd2af2aa2f9be660fc1c789405b5188b904d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>config: get rid of a useless asignment</title>
<updated>2013-08-12T09:40:57+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-08-12T09:21:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=43e5dda70249ede020a57f3888356a0dcb96da48'/>
<id>43e5dda70249ede020a57f3888356a0dcb96da48</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>added new type and several functions to git_strmap</title>
<updated>2013-08-08T09:07:03+00:00</updated>
<author>
<name>Nico von Geyso</name>
<email>Nico.Geyso@FU-Berlin.de</email>
</author>
<published>2013-03-17T19:39:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=6385fc5ff5d669d3ec99d89f19c5860cf53011ba'/>
<id>6385fc5ff5d669d3ec99d89f19c5860cf53011ba</id>
<content type='text'>
This step is needed to easily add iterators to git_config_backend
As well use these new git_strmap functions to implement foreach

* git_strmap_iter
* git_strmap_has_data(...)
* git_strmap_begin(...)
* git_strmap_end(...)
* git_strmap_next(...)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This step is needed to easily add iterators to git_config_backend
As well use these new git_strmap functions to implement foreach

* git_strmap_iter
* git_strmap_has_data(...)
* git_strmap_begin(...)
* git_strmap_end(...)
* git_strmap_next(...)
</pre>
</div>
</content>
</entry>
</feed>
