Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
4 : // Use of this source code is governed by a BSD-style license that can be
5 : // found in the LICENSE file.
6 :
7 : #ifndef BASE_STRING_UTIL_POSIX_H_
8 : #define BASE_STRING_UTIL_POSIX_H_
9 :
10 : #include <stdarg.h>
11 : #include <stdio.h>
12 : #include <string.h>
13 : #include <wchar.h>
14 :
15 : #include "base/logging.h"
16 :
17 : namespace base {
18 :
19 : // Chromium code style is to not use malloc'd strings; this is only for use
20 : // for interaction with APIs that require it.
21 : inline char* strdup(const char* str) {
22 : return ::strdup(str);
23 : }
24 :
25 : inline int strcasecmp(const char* string1, const char* string2) {
26 : return ::strcasecmp(string1, string2);
27 : }
28 :
29 : inline int strncasecmp(const char* string1, const char* string2, size_t count) {
30 : return ::strncasecmp(string1, string2, count);
31 : }
32 :
33 0 : inline int vsnprintf(char* buffer, size_t size,
34 : const char* format, va_list arguments) {
35 0 : return ::vsnprintf(buffer, size, format, arguments);
36 : }
37 :
38 15 : inline int vswprintf(wchar_t* buffer, size_t size,
39 : const wchar_t* format, va_list arguments) {
40 15 : DCHECK(IsWprintfFormatPortable(format));
41 15 : return ::vswprintf(buffer, size, format, arguments);
42 : }
43 :
44 : } // namespace base
45 :
46 : #endif // BASE_STRING_UTIL_POSIX_H_
|