This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Many places in bfd, we do something like p = malloc (strlen (s) + 1); if (!p) return false; strcpy (p, s); which is a little inefficient since strcpy will need to check for the terminating 0 or call strlen itself. This patch changes the above to len = strlen (s) + 1; p = malloc (len); if (!p) return false; memcpy (p, s, len);
Why not just use [x]strdup()? Andrew
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |