This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: Build failure on Linux - strnicmp undefined


>>>>> "muller" == muller  <muller@cerbere.u-strasbg.fr> writes:
muller> Thanks for checking it in. I only realized this after
muller> committing it when I tried to compile it also on a Linux
muller> machine.
muller>
muller> However, I also found strnicmp in src/gdb/nlm/gdserve.c so I
muller> wasn't sure that I should do the change.

That's something of a special case.  nlm/* is a gdbserver for NetWare
systems.  With a bit of work and restructuring, I think it could be
restructured and folded into the "real" gdbserver.  I don't know if
anyone cares anymore.

muller> On the other side you can find in src/gdb/ser-e7kpc.c that
muller> strncasecmp is replaced by strnicmp by a macro for MSVC but
muller> several other files using strncasecmp do not have this macro
muller> defined. Unless this is automatically created by the configure
muller> execution, in which case the defines inside the c source files
muller> would be unnecessary.

When different idioms that accomplish the same thing are used in the
same program it is difficult to understand which one is prefered.  As
code is often used as an example, it's best to have good examples for
people to follow.

In this case, I think we can simply use str{n,}casecmp() throughout
the code, because an implementation is provided in libiberty.  If for
some reason it's important to use str{n,}icmp() on those systems that
provide that API instead, I think the proper place to do this is in
gdb_string.h instead of scattered throughout half a dozen *.c files.

        --jtc

-- 
J.T. Conklin
RedBack Networks

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