ipc/chromium/src/base/string_util_posix.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/string_util_posix.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef BASE_STRING_UTIL_POSIX_H_
     1.9 +#define BASE_STRING_UTIL_POSIX_H_
    1.10 +
    1.11 +#include <stdarg.h>
    1.12 +#include <stdio.h>
    1.13 +#include <string.h>
    1.14 +#include <wchar.h>
    1.15 +
    1.16 +#include "base/logging.h"
    1.17 +
    1.18 +namespace base {
    1.19 +
    1.20 +// Chromium code style is to not use malloc'd strings; this is only for use
    1.21 +// for interaction with APIs that require it.
    1.22 +inline char* strdup(const char* str) {
    1.23 +  return ::strdup(str);
    1.24 +}
    1.25 +
    1.26 +inline int strcasecmp(const char* string1, const char* string2) {
    1.27 +  return ::strcasecmp(string1, string2);
    1.28 +}
    1.29 +
    1.30 +inline int strncasecmp(const char* string1, const char* string2, size_t count) {
    1.31 +  return ::strncasecmp(string1, string2, count);
    1.32 +}
    1.33 +
    1.34 +inline int vsnprintf(char* buffer, size_t size,
    1.35 +                     const char* format, va_list arguments) {
    1.36 +  return ::vsnprintf(buffer, size, format, arguments);
    1.37 +}
    1.38 +
    1.39 +inline int vswprintf(wchar_t* buffer, size_t size,
    1.40 +                     const wchar_t* format, va_list arguments) {
    1.41 +  DCHECK(IsWprintfFormatPortable(format));
    1.42 +  return ::vswprintf(buffer, size, format, arguments);
    1.43 +}
    1.44 +
    1.45 +}  // namespace base
    1.46 +
    1.47 +#endif  // BASE_STRING_UTIL_POSIX_H_

mercurial