Change in libosmocore[master]: logging: log_vty_command_string: Fix undercount of buf alloc size

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Tue Jul 24 17:48:21 UTC 2018


Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/10134 )

Change subject: logging: log_vty_command_string: Fix undercount of buf alloc size
......................................................................


Patch Set 1: Code-Review+1

(5 comments)

Looks fine for me.

I have posted some comments for further improvements of this function.
Not necessary in the current change, I just couldn't resist :)

https://gerrit.osmocom.org/#/c/10134/1/src/logging.c
File src/logging.c:

https://gerrit.osmocom.org/#/c/10134/1/src/logging.c@943
PS1, Line 943: 		size += strlen(info->cat[i].name) + 1;
AFAIU, it also accounts '|' after each category name.
Even for the last one, where we don't have '|', i.e.

  "logging level (all|rll|cc|...|ljibuf)"


https://gerrit.osmocom.org/#/c/10134/1/src/logging.c@947
PS1, Line 947: 		size += strlen(loglevel_strs[i].str) + 1;
Same here:

  "(everything|debug|...|fatal)"


https://gerrit.osmocom.org/#/c/10134/1/src/logging.c@950
PS1, Line 950: 	str = talloc_zero_size(tall_log_ctx, size);
Then here we should have 2 useless bytes.


https://gerrit.osmocom.org/#/c/10134/1/src/logging.c@965
PS1, Line 965: 				name[j] = tolower((unsigned char)info->cat[i].name[j]);
We can simplify this by using pointer arithmetics and osmo_str2lower().


https://gerrit.osmocom.org/#/c/10134/1/src/logging.c@986
PS1, Line 986: 		for (j = 0; j < loglevel_str_len; j++)
This part also can be simplified...



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7aca0ce3d2981001e8081f7cee0dea3e2aaf8f7c
Gerrit-Change-Number: 10134
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Comment-Date: Tue, 24 Jul 2018 17:48:21 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180724/0be7f8e1/attachment.htm>


More information about the gerrit-log mailing list