mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
lws_ptr_diff_size_t
lws_ptr_diff() is a very handy helper reducing the pointer delta to an int count of bytes... however many times we actually want a size_t count of bytes since that's the type of the argument we're trying to feed. Let's establish a variant that naturally issues size_t.
This commit is contained in:
parent
9b42fc6aae
commit
454adf55ef
1 changed files with 3 additions and 0 deletions
|
@ -186,6 +186,9 @@ lws_buflist_describe(struct lws_buflist **head, void *id, const char *reason);
|
|||
#define lws_ptr_diff(head, tail) \
|
||||
((int)((char *)(head) - (char *)(tail)))
|
||||
|
||||
#define lws_ptr_diff_size_t(head, tail) \
|
||||
((size_t)(ssize_t)((char *)(head) - (char *)(tail)))
|
||||
|
||||
/**
|
||||
* lws_snprintf(): snprintf that truncates the returned length too
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue