Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sky/engine/wtf/StringExtras.h

Issue 1205793002: Remove config.h (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/wtf/PassRefPtr.h ('k') | sky/engine/wtf/ThreadIdentifierDataPthreads.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef SKY_ENGINE_WTF_STRINGEXTRAS_H_ 26 #ifndef SKY_ENGINE_WTF_STRINGEXTRAS_H_
27 #define SKY_ENGINE_WTF_STRINGEXTRAS_H_ 27 #define SKY_ENGINE_WTF_STRINGEXTRAS_H_
28 28
29 #include <stdarg.h> 29 #include <stdarg.h>
30 #include <stdio.h> 30 #include <stdio.h>
31 #include <string.h> 31 #include <string.h>
32 #include <strings.h> 32 #include <strings.h>
33 #include "sky/engine/wtf/OperatingSystem.h"
33 34
34 #if !HAVE(STRNSTR) 35 #if !HAVE(STRNSTR)
35 36
36 inline char* strnstr(const char* buffer, const char* target, size_t bufferLength ) 37 inline char* strnstr(const char* buffer, const char* target, size_t bufferLength )
37 { 38 {
38 size_t targetLength = strlen(target); 39 size_t targetLength = strlen(target);
39 if (targetLength == 0) 40 if (targetLength == 0)
40 return const_cast<char*>(buffer); 41 return const_cast<char*>(buffer);
41 for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) { 42 for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) {
42 if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1 ) == 0) 43 if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1 ) == 0)
43 return const_cast<char*>(start); 44 return const_cast<char*>(start);
44 } 45 }
45 return 0; 46 return 0;
46 } 47 }
47 48
48 #endif 49 #endif
49 50
50 #endif // SKY_ENGINE_WTF_STRINGEXTRAS_H_ 51 #endif // SKY_ENGINE_WTF_STRINGEXTRAS_H_
OLDNEW
« no previous file with comments | « sky/engine/wtf/PassRefPtr.h ('k') | sky/engine/wtf/ThreadIdentifierDataPthreads.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698