Donate Share April 2004: Project of the Month

BZFlag - Multiplayer 3D Tank Game

Tracker: Patches

5 Simplify code with strdup(), fix off by one error - ID: 2895015
Last Update: Attachment added ( russellbryant )

1) Simplify (and make slightly more efficient) some code by using strdup()
instead of malloc()/strncpy().

2) Fix an off by one error that existed with the use of strncpy(). The
third argument must be the buffer size minus 1. The value provided was the
full buffer size.

3) Fix a smelling error in a comment.

4) Remove an unnecessary check before calling free() since free(NULL) is
safe.


Russell Bryant ( russellbryant ) - 2009-11-10 04:25

5

Open

None

Nobody/Anonymous

BZFS

None

Public


Comments

No follow-up comments have been posted.

Attached File ( 1 )

Filename Description Download
bzfsapi_strdup.rev1.diff Download

Change ( 1 )

Field Old Value Date By
File Added 350232: bzfsapi_strdup.rev1.diff 2009-11-10 04:25 russellbryant