Bug 24884 - Include strings.h for strcasecmp()
Summary: Include strings.h for strcasecmp()
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 27065
  Show dependency treegraph
Reported: 2009-03-27 06:56 PDT by Laszlo Gombos
Modified: 2009-07-07 20:57 PDT (History)
2 users (show)

See Also:

Include strings.h in StringExtras.h if available (1.43 KB, patch)
2009-03-27 07:04 PDT, Laszlo Gombos
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Gombos 2009-03-27 06:56:33 PDT
IEEE Std 1003.1-2001 placed strcasecmp() in strings.h. 

Most (but not all) platforms also declare strcasecmp in string.h, so the lack of the strings.h include usually does not get noticed.

The compile time problem I run into is http://trac.webkit.org/browser/trunk/WebCore/loader/TextResourceDecoder.cpp calls strcasecmp() but strings.h is not included.

A similar case has been reported an solved in http://trac.webkit.org/changeset/38176/trunk/JavaScriptCore/runtime/DateMath.cpp. 

There are at least two options to consider - (a) continue including strings.h in each cpp where strcasecmp() is called or (b) include strings.h in StringExtras.h where strcasecmp() is implemented for Win.

I feel that (b) might be a more future-proof (since Win ports are well maintained).

Patch follows.
Comment 1 Laszlo Gombos 2009-03-27 07:04:39 PDT
Created attachment 29009 [details]
Include strings.h in StringExtras.h if available
Comment 2 Darin Adler 2009-03-27 07:19:22 PDT
Comment on attachment 29009 [details]
Include strings.h in StringExtras.h if available

Comment 3 Simon Hausmann 2009-03-27 09:23:15 PDT
Landed in r42037