Add simple reference-counted string allocator and use it for passing

around references to the sudoers path.  This lets us avoid making
copies of the sudoers path for the errorfile as well as each Defaults
entry.
This commit is contained in:
Todd C. Miller
2016-11-11 16:18:27 -07:00
parent b5e3a7aef2
commit 90995c0acf
10 changed files with 177 additions and 78 deletions

View File

@@ -403,4 +403,10 @@ bool sudoers_gc_add(enum sudoers_gc_types type, void *ptr);
bool sudoers_gc_remove(enum sudoers_gc_types type, void *ptr);
void sudoers_gc_init(void);
/* rcstr.c */
char *rcstr_dup(const char *src);
char *rcstr_alloc(size_t len);
char *rcstr_addref(const char *s);
void rcstr_delref(const char *s);
#endif /* SUDOERS_SUDOERS_H */