Skip to contentSkip to conversation

mem: add mem helper functions

PATCH Cody P Schafer 1 participant 1 message Sep 6, 2015 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 4 lines
Quoted 1 line

+static inline char *memeq(const void *a, size_t al, const void *b, size_t bl)

This should have type 'bool', not char *, surely?

Whoops

Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+static inline bool memends(const void *s, size_t s_len, const void *suffix, size_t suffix_len)
+{
+     return (s_len >= suffix_len) && (memcmp((const char *)s + s_len - suffix_len,
+                                             suffix, suffix_len) == 0);
+}
+

memends_str() for symmetry?

I didn't need it, but that does make sense.

I'll send out a fixed-up changeset shortly.
_______________________________________________
ccan mailing list
[email protected]
https://lists.ozlabs.org/listinfo/ccan