Change in ...libosmocore[master]: logging: Use reentrant ctime_r instead of ctime

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jun 12 18:04:03 UTC 2019


fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/14429 )

Change subject: logging: Use reentrant ctime_r instead of ctime
......................................................................


Patch Set 2: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/14429/2/src/logging.c 
File src/logging.c:

https://gerrit.osmocom.org/#/c/14429/2/src/logging.c@370 
PS2, Line 370: snprintf
Hmm, I think I see a possible optimization:

  /* man ctime: we need at least 26 bytes */
  if (rem < 26)
    goto err;

  /* Get human-readable representation of time */
  if (!ctime_r(&tm, buf + offset))
    goto err;

  /* Get rid of useless '\n' */
  ret = strlen(buf + offset) - 1;
  if (ret <= 0)
    goto err;

  OSMO_SNPRINTF_RET(ret, rem, offset, len);

So we can avoid calling snprintf() and overriding '\n' manually.



-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14429
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I19ebf29a2f1fc855bb7d56766b338c7c3432dfd1
Gerrit-Change-Number: 14429
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Comment-Date: Wed, 12 Jun 2019 18:04:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190612/bc2bfbf7/attachment.htm>


More information about the gerrit-log mailing list