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

Holger Freyther gerrit-no-reply at lists.osmocom.org
Thu Jan 19 16:48:02 UTC 2017


Patch Set 5:

> yea it is kind of dangerous ... however, our entire code base uses
 > sizeof *everywhere* except one or two exceptions (<1%).
 > 
 > The name osmo_strcpy_sizeof(a, b) would highlight this and be
 > slightly shorter than osmo_strlcpy(a, b, sizeof(a)) ... what do you
 > think, rather abandon?

yes but the array and sizeof are next to each other. check this http://stackoverflow.com/questions/19452971/array-size-macro-that-rejects-pointers. We could make your scpy work only with arrays...

-- 
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