GSoC Project | Basic Support for Trace Compass

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Aug 12 05:54:44 UTC 2019


On 11/08/2019 09:51, Ravindra Kumar Meena wrote:
> rtems-main.c coding style fix:
> https://github.com/rmeena840/rtems-tools/commit/eeb2067783f7e375087bee913342ce3fecce7883

This is too complicated:

+    strcpy( filename, "event_" );
      snprintf( file_index, sizeof( file_index ), "%ld", i );
      strcat( filename, file_index );

In addition, the strcpy() and strcat() functions are dangerous to use. 
Why don't you simply use:

snprintf( filename, sizeof( filename ), "event_%zu", i );

?

The i is of type size_t, so %ld is not the right format. Firstly, the 
signedness is wrong, secondly using "l" is not portable.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list