diff options
| author | David M. Syzdek <david@syzdek.net> | 2019-11-30 01:19:22 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2019-11-30 01:19:22 -0900 |
| commit | 7c7d7e043b9196fd979e88a65e647c0c2eca8482 (patch) | |
| tree | c9a3676fb93f691734f2156ed41cff9061c5f584 /lib | |
| parent | 332bb9a66242c0651ec321fb9e73aedcd6c9f673 (diff) | |
| download | ldap-utils-7c7d7e043b9196fd979e88a65e647c0c2eca8482.tar.gz ldap-utils-7c7d7e043b9196fd979e88a65e647c0c2eca8482.tar.bz2 ldap-utils-7c7d7e043b9196fd979e88a65e647c0c2eca8482.tar.xz ldap-utils-7c7d7e043b9196fd979e88a65e647c0c2eca8482.zip | |
libldapschema: adding ldapschema_stradd()
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libldapschema/lmemory.c | 24 | ||||
| -rw-r--r-- | lib/libldapschema/lmemory.h | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/libldapschema/lmemory.c b/lib/libldapschema/lmemory.c index c875d6e..052de6d 100644 --- a/lib/libldapschema/lmemory.c +++ b/lib/libldapschema/lmemory.c | |||
| @@ -768,6 +768,30 @@ void * ldapschema_oid(LDAPSchema * lsd, const char * oid, uint32_t type) | |||
| 768 | } | 768 | } |
| 769 | 769 | ||
| 770 | 770 | ||
| 771 | char * ldapschema_stradd(char ** s1p, const char * s2) | ||
| 772 | { | ||
| 773 | char * s1; | ||
| 774 | size_t l1; | ||
| 775 | size_t l2; | ||
| 776 | void * ptr; | ||
| 777 | |||
| 778 | assert(s1p != NULL); | ||
| 779 | assert(*s1p != NULL); | ||
| 780 | assert(s2 != NULL); | ||
| 781 | |||
| 782 | s1 = *s1p; | ||
| 783 | l1 = strlen(s1); | ||
| 784 | l2 = strlen(s2); | ||
| 785 | |||
| 786 | if ((ptr = realloc(s1, (l1+l2+1))) == NULL) | ||
| 787 | return(NULL); | ||
| 788 | s1 = ptr; | ||
| 789 | *s1p = s1; | ||
| 790 | |||
| 791 | return(strncat(s1, s2, (l1+l2+1))); | ||
| 792 | } | ||
| 793 | |||
| 794 | |||
| 771 | void ldapschema_syntax_free(LDAPSchemaSyntax * syntax) | 795 | void ldapschema_syntax_free(LDAPSchemaSyntax * syntax) |
| 772 | { | 796 | { |
| 773 | assert(syntax != NULL); | 797 | assert(syntax != NULL); |
diff --git a/lib/libldapschema/lmemory.h b/lib/libldapschema/lmemory.h index 5cb1c4d..c0b210c 100644 --- a/lib/libldapschema/lmemory.h +++ b/lib/libldapschema/lmemory.h | |||
| @@ -128,6 +128,11 @@ ldapschema_oid( | |||
| 128 | const char * oid, | 128 | const char * oid, |
| 129 | uint32_t type ); | 129 | uint32_t type ); |
| 130 | 130 | ||
| 131 | char * | ||
| 132 | ldapschema_stradd( | ||
| 133 | char ** s1, | ||
| 134 | const char * s2 ); | ||
| 135 | |||
| 131 | void | 136 | void |
| 132 | ldapschema_syntax_free( | 137 | ldapschema_syntax_free( |
| 133 | LDAPSchemaSyntax * syntax ); | 138 | LDAPSchemaSyntax * syntax ); |
