MCPcopy Create free account
hub / github.com/ElementsProject/lightning / memends

Function memends

ccan/ccan/mem/mem.h:192–197  ·  view source on GitHub ↗

* memends - Does this byte array end with a given byte-array suffix? * @s: byte array * @s_len: length in bytes * @suffix: byte array suffix * @suffix_len: length of suffix in bytes * * Returns true if @suffix appears as a substring at the end of @s, * false otherwise. */

Source from the content-addressed store, hash-verified

190 * false otherwise.
191 */
192PURE_FUNCTION
193static inline bool memends(const void *s, size_t s_len, const void *suffix, size_t suffix_len)
194{
195 return (s_len >= suffix_len) && (memcmp((const char *)s + s_len - suffix_len,
196 suffix, suffix_len) == 0);
197}
198
199/**
200 * memends_str - Does this byte array end with a string suffix?

Callers 3

memends_strFunction · 0.85
mainFunction · 0.85
parse_amount_satFunction · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68