Commit 17c15b53 authored by Niels Möller's avatar Niels Möller
Browse files

* src/format.c (lsh_get_cstring): Use const for input and output.

Rev: src/format.c:1.42
Rev: src/format.h:1.34
parent cde525b5
......@@ -599,8 +599,8 @@ static int write_decimal_length(UINT8 *buffer, UINT32 n)
return length + 1;
}
char *
lsh_get_cstring(struct lsh_string *s)
const char *
lsh_get_cstring(const struct lsh_string *s)
{
return (s && !memchr(s->data, '\0', s->length) ? s->data : NULL);
}
......
......@@ -84,10 +84,11 @@ void ssh_format_write(const char *format, UINT32 length, UINT8 *buffer, ...);
UINT32 ssh_vformat_length(const char *format, va_list args);
void ssh_vformat_write(const char *format, UINT32 length, UINT8 *buffer, va_list args);
/* FIXME: Do we need a variant that handles non-const strings? */
/* Returns an ordinary NUL-terminated string, or NULL if the string
* contains any NUL-character. */
char *
lsh_get_cstring(struct lsh_string *s);
const char *
lsh_get_cstring(const struct lsh_string *s);
/* Short cuts */
#define lsh_string_dup(s) (ssh_format("%lS", (s)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment