osmo-trx[master]: Transceiver.cpp: use pointer arithmetics for CMD parsing

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
Fri Mar 9 14:16:26 UTC 2018


Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/#/c/7172/1/Transceiver52M/Transceiver.cpp
File Transceiver52M/Transceiver.cpp:

Line 672:   size_t cmd_len = strlen(cmd);
> as the string of cmd is known at compile time, better pass cmd_len as param
Thanks!

> mark it as static and let the compiler decide

Done.

> better use lower caps -> match_cmd

Done.

Still not sure about passing the length of a command.
I also don't like that 'cmd_len' will be recalculated
every time, and passing the length statically would be
better, but 'sizeof("POWEROFF")-1' looks ugly to me, sorry.

I am anyway open for any ideas ;)


Line 731:     sscanf(params, "%d %d", &ts, &ss);
> We should be checking the return value of sscanf to make sure it matches th
A topic for a separate change, here I am only moving
to simple pointer arithmetics.


Line 733:     sprintf(response,"RSP HANDOVER 0 %d %d",ts,ss);
> I'd use snprintf in here and all other responses. Probably you are already 
A topic for a separate change, here I am only moving
to simple pointer arithmetics.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I226ca0771e63228cf5e04ef9766057d4107fdd11
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list