Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
17c15b53
Commit
17c15b53
authored
Apr 26, 2001
by
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/format.c
View file @
17c15b53
...
...
@@ -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
);
}
...
...
src/format.h
View file @
17c15b53
...
...
@@ -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)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment