diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-03 19:58:47 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-03 19:58:47 +0000 |
commit | c015b02b43fa0d7743eb555fdf50fc433dc67b98 (patch) | |
tree | d52ba80d95fb4ce0b6d50b3beaecf9c21908201a /source3/include | |
parent | 37983b979fc99272eef1c61c93294e93c3c1c714 (diff) | |
download | samba-c015b02b43fa0d7743eb555fdf50fc433dc67b98.tar.gz samba-c015b02b43fa0d7743eb555fdf50fc433dc67b98.tar.bz2 samba-c015b02b43fa0d7743eb555fdf50fc433dc67b98.zip |
three types of array-creation / array-deletion functions:
char*
UNISTR2*
SID*
decided to create a higher-order function set, add_item_to_array()
free_item_array().
higher-order support routines needed to add a new type:
type* item_dup(const type*)
void item_free(type*)
of course, strdup() and free() are perfect, pre-existing examples
of such functions, used in the implementation of add_chars_to_array()
and free_char_array().
sid_dup() and free() work for the add_sids_to_array() and free_sid_array()
implementations.
use unistr2_dup() and created unistr2_free() because the functionality
behind these may change into something horrible, like [horror] dynamic
memory allocation of the UNISTR2 character array. argh!!!!
jean-francois, this function set implements what we talked about over...
a year ago, now :-)
(This used to be commit a80ea2eb47d298095eb6e5b0455309daa3a631cb)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/proto.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 711eeb0798..d6b7abba95 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -480,10 +480,16 @@ int set_maxfiles(int requested_max); void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name); BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name); BOOL become_user_permanently(uid_t uid, gid_t gid); +void free_void_array(uint32 num_entries, void **entries, + void(free_item)(void*)); +BOOL add_item_to_array(uint32 *len, void ***array, const void *item, + void*(item_dup)(const void*)); void free_char_array(uint32 num_entries, char **entries); BOOL add_chars_to_array(uint32 *len, char ***array, const char *name); -BOOL add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); +void free_unistr_array(uint32 num_entries, UNISTR2 **entries); +BOOL add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *name); void free_sid_array(uint32 num_entries, DOM_SID **entries); +BOOL add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); /*The following definitions come from lib/util_file.c */ @@ -2214,7 +2220,9 @@ BOOL smb_io_buffer5(char *desc, BUFFER5 *buf5, prs_struct *ps, int depth); BOOL make_buffer2(BUFFER2 *str, const char *buf, int len); BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth); BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf); -BOOL copy_unistr2(UNISTR2 *str, UNISTR2 *from); +BOOL copy_unistr2(UNISTR2 *str, const UNISTR2 *from); +UNISTR2 *unistr2_dup(const UNISTR2 *name); +void unistr2_free(UNISTR2 *name); BOOL make_string2(STRING2 *str, char *buf, int len); BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth); BOOL make_unistr2(UNISTR2 *str, const char *buf, int len); |