mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-15 10:07:39 -05:00
New utility functions to make ptrlens.
One to make one from a NUL-terminated string, and another to make one from a strbuf. I've switched over all the obvious cases where I should have been using these functions.
This commit is contained in:
10
misc.c
10
misc.c
@ -1243,6 +1243,16 @@ ptrlen make_ptrlen(const void *ptr, size_t len)
|
||||
return pl;
|
||||
}
|
||||
|
||||
ptrlen ptrlen_from_asciz(const char *str)
|
||||
{
|
||||
return make_ptrlen(str, strlen(str));
|
||||
}
|
||||
|
||||
ptrlen ptrlen_from_strbuf(strbuf *sb)
|
||||
{
|
||||
return make_ptrlen(sb->u, sb->len);
|
||||
}
|
||||
|
||||
int ptrlen_eq_string(ptrlen pl, const char *str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
Reference in New Issue
Block a user