libosmocore[master]: utils: add osmo_strscpy() macro to use sizeof(dst)

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jan 19 16:29:18 UTC 2017


Patch Set 5:

> Linux's strscpy has different semantic/parameters. Not sure if you
 > want to clash here. You might also implement it as a static inline
 > instead of a macro (or add () around the parameters).

Will sizeof() work with a static inline??

Hmm wasn't aware of strscpy(). Can't find it on my man nor /usr/include, but found https://lwn.net/Articles/659214/

What to call it, osmo_strzcpy(), kind of like the "%zu" printf format char for size_t? osmo_strcpy_sizeof(), to clearly indicate use of sizeof() to prevent bugs with pointers-to-a-buf?

-- 
To view, visit https://gerrit.osmocom.org/1599
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie973fc51835066540eba7ed2946ddf33a268b022
Gerrit-PatchSet: 5
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-HasComments: No


More information about the gerrit-log mailing list