This is the mail archive of the binutils@sourceware.org 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]

Re: Patch/PE-COFF: Provide default suffix to NAME or LIBRARY names in .def files


Hi Danny,

Also, on some architectures, I believe that strcpy would be faster
than memcpy for this operation.

I didn't know that.


Does using memcpy buy us anything here?

I had just called memcpy in line above, so I called it again
But if strcpy is faster, I'll change to that.

Do we really need to be concerned about speed here ?
I think that clarity of code is more important in this case, and so I would recommend a simpler approach, eg:


  if (strchr (image_name, '.') == 0)
    {
       const char * suffix = is_dll ? ".dll" : ".exe";

       def->name = xmalloc (strlen (image_name) + strlen (suffix) + 1);
       sprintf (def->name, "%s%s, image_name, suffix);
    }

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]