libosmocore[master]: utils: add osmo_strncpy(), as drop-in replacement for strncpy()

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Jan 15 18:04:32 UTC 2017


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/1598/2/src/utils.c
File src/utils.c:

Line 378:  * one iteration of \a src, so should be more optimal than osmo_strlcpy().
I really don't think we need to worry about this, given the number of string copies we typically do in protocol processing (not many, all our protocols are binary, except maybe ctrl interface).  Also, given the fact that the strlen() call pre-fetches the entire string data into the cache, not sure how much perfomance difference there is n practise?

Overall I'm not sure if we should proliferate various str*cpy() functions or rather use one (osmo_strlcpy) everywhere and migrate related code.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If8ba5361c1d0c90973a1447ce30c1198946a5265
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


More information about the gerrit-log mailing list