1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05:00

A few new minor utility functions.

A function to compare two strings _both_ in ptrlen form (I've had
ptrlen_eq_string for ages, but for some reason, never quite needed
ptrlen_eq_ptrlen). A function to ask whether one ptrlen starts with
another (and, optionally, return a ptrlen giving the remaining part of
the longer string). And the va_list version of logeventf, which I
really ought to have written in the first place by sheer habit, even
if it was only needed by logeventf itself.
This commit is contained in:
Simon Tatham
2018-10-13 17:03:27 +01:00
parent 3229d468b9
commit 14f797305a
4 changed files with 28 additions and 3 deletions

2
misc.h
View File

@ -100,6 +100,8 @@ ptrlen make_ptrlen(const void *ptr, size_t len);
ptrlen ptrlen_from_asciz(const char *str);
ptrlen ptrlen_from_strbuf(strbuf *sb);
int ptrlen_eq_string(ptrlen pl, const char *str);
int ptrlen_eq_ptrlen(ptrlen pl1, ptrlen pl2);
int ptrlen_startswith(ptrlen whole, ptrlen prefix, ptrlen *tail);
char *mkstr(ptrlen pl);
int string_length_for_printf(size_t);
/* Derive two printf arguments from a ptrlen, suitable for "%.*s" */