diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-14 00:51:08 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-14 00:51:08 +0200 |
commit | b23b3f1d9951df3ea7cc074de40db04bdf0d3a1c (patch) | |
tree | d4fe8f4c4aa71c6cebe7d1d92dc25ea145d98cd1 /libssh/string.c | |
parent | 46b249f5ce552bba2e0a170cb0b8052b1419924b (diff) | |
download | libssh-b23b3f1d9951df3ea7cc074de40db04bdf0d3a1c.tar.gz libssh-b23b3f1d9951df3ea7cc074de40db04bdf0d3a1c.tar.xz libssh-b23b3f1d9951df3ea7cc074de40db04bdf0d3a1c.zip |
Sanitize libssh namespace + legacy wrappers
Diffstat (limited to 'libssh/string.c')
-rw-r--r-- | libssh/string.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libssh/string.c b/libssh/string.c index e56fdcee..0a036adf 100644 --- a/libssh/string.c +++ b/libssh/string.c @@ -47,7 +47,7 @@ * * @return The newly allocated string, NULL on error. */ -struct ssh_string_struct *string_new(size_t size) { +struct ssh_string_struct *ssh_string_new(size_t size) { struct ssh_string_struct *str = NULL; str = malloc(size + 4); @@ -70,7 +70,7 @@ struct ssh_string_struct *string_new(size_t size) { * * @return 0 on success, < 0 on error. */ -int string_fill(struct ssh_string_struct *s, const void *data, size_t len) { +int ssh_string_fill(struct ssh_string_struct *s, const void *data, size_t len) { if ((s == NULL) || (data == NULL) || (len == 0) || (len > s->size)) { return -1; @@ -90,7 +90,7 @@ int string_fill(struct ssh_string_struct *s, const void *data, size_t len) { * * @note The nul byte is not copied nor counted in the ouput string. */ -struct ssh_string_struct *string_from_char(const char *what) { +struct ssh_string_struct *ssh_string_from_char(const char *what) { struct ssh_string_struct *ptr = NULL; size_t len = strlen(what); @@ -111,7 +111,7 @@ struct ssh_string_struct *string_from_char(const char *what) { * * @return The size of the content of the string, 0 on error. */ -size_t string_len(struct ssh_string_struct *s) { +size_t ssh_string_len(struct ssh_string_struct *s) { if (s == NULL) { return ntohl(0); } @@ -130,7 +130,7 @@ size_t string_len(struct ssh_string_struct *s) { * @note If the input SSH string contains zeroes, some parts of the output * string may not be readable with regular libc functions. */ -char *string_to_char(struct ssh_string_struct *s) { +char *ssh_string_to_char(struct ssh_string_struct *s) { size_t len = ntohl(s->size) + 1; char *new = malloc(len); @@ -150,7 +150,7 @@ char *string_to_char(struct ssh_string_struct *s) { * * @return Newly allocated copy of the string, NULL on error. */ -struct ssh_string_struct *string_copy(struct ssh_string_struct *s) { +struct ssh_string_struct *ssh_string_copy(struct ssh_string_struct *s) { struct ssh_string_struct *new = malloc(ntohl(s->size) + 4); if (new == NULL) { @@ -167,11 +167,11 @@ struct ssh_string_struct *string_copy(struct ssh_string_struct *s) { * * @param[in] s The string to burn. */ -void string_burn(struct ssh_string_struct *s) { +void ssh_string_burn(struct ssh_string_struct *s) { if (s == NULL) { return; } - memset(s->string, 'X', string_len(s)); + memset(s->string, 'X', ssh_string_len(s)); } /** @@ -181,7 +181,7 @@ void string_burn(struct ssh_string_struct *s) { * * @return Return the data of the string or NULL on error. */ -void *string_data(struct ssh_string_struct *s) { +void *ssh_string_data(struct ssh_string_struct *s) { if (s == NULL) { return NULL; } @@ -194,7 +194,7 @@ void *string_data(struct ssh_string_struct *s) { * * \param[in] s The SSH string to delete. */ -void string_free(struct ssh_string_struct *s) { +void ssh_string_free(struct ssh_string_struct *s) { SAFE_FREE(s); } |