Description
Hey,
regarding extending libgit2 with non-callback-based iterators (#1384) I looked at git_config_foreach
. It seems that it's not that trivial (in comparison to git_notes) because here we need changes deep in the code. I think foreach
should be replaced in general in git_config_backend
. As @arrbee suggested in libgit2/pygit2#183 with a new enumeration api, libgit2 could benefit as well in moving backend code to common code. I had something like the following for the backend struct in mind:
struct git_config_backend {
unsigned int version;
struct git_config *cfg;
int (*open) ...
int (*get) ..
int (*set) ...
int (*del) ...
int (*refresh) ..
int (*free) ...
int (*iterator) ... // initializes iterator
int (*next) ... // returns the next entry in iterator
}
With this it's may be possible to get rid of the pattern matching functions in the low level backend and implement them one abstraction layer above with help of the iterator functions. The current default backend (built on top of khash) supports with khiter
as well classic enumeration. What do you think?