A (very!) small optimization in tasks.c

hermarcel wrote on Thursday, February 03, 2005:

Just a minor thing…

In prvInitialiseTCBVariables() the taskname is copied to the tcb after verifying it’s length. When it fits a strcpy is used, otherwise a strncpy.

I think it simplifies the code (and save some cycles, too) when the test is removed and the strncpy is always used.

rtel wrote on Thursday, February 03, 2005:

Good point!  I’ve added it to the list.

Regards.

hermarcel wrote on Friday, February 04, 2005:

It would be neat, I think, if a \0 was always put in the last char of the taskname. Then, when a taskname is too long to fit, it still is a properly terminated string.

The strncpy should copy "maxlen - 1" chars.