| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 /* | |
| 8 * str_utils.h | |
| 9 * | |
| 10 * Defines support string routines for the instruction enumerator. | |
| 11 */ | |
| 12 | |
| 13 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ | |
| 14 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ | |
| 15 | |
| 16 #include "native_client/src/include/nacl_macros.h" | |
| 17 | |
| 18 /* If string s begins with string prefix, return a pointer to the | |
| 19 * first byte after the prefix. Else return s. | |
| 20 */ | |
| 21 char *SkipPrefix(char *s, const char *prefix); | |
| 22 | |
| 23 /* Return a pointer to s with leading spaces removed. */ | |
| 24 const char *strip(const char *s); | |
| 25 | |
| 26 /* Updates the string by removing trailing spaces/newlines. */ | |
| 27 void rstrip(char *s); | |
| 28 | |
| 29 /* Find substring ss in string s. Returns a pointer to the substring | |
| 30 * on success, NULL on failure. | |
| 31 */ | |
| 32 const char *strfind(const char *s, const char *ss); | |
| 33 | |
| 34 /* If string ss appears in string s, return a pointer to the first byte | |
| 35 * after ss. Otherwise return NULL. | |
| 36 */ | |
| 37 const char *strskip(const char *s, const char *ss); | |
| 38 | |
| 39 /* Copies source to dest, like strncpy, but replaces the last | |
| 40 * byte of the dest (based on buffer size) with a null character, | |
| 41 * so that we are guaranteed to have a valid string. | |
| 42 */ | |
| 43 void cstrncpy(char *dest, const char *src, size_t n); | |
| 44 | |
| 45 /* Copy src to dest, stoping at character c. */ | |
| 46 void strncpyto(char *dest, const char *src, size_t n, char c); | |
| 47 | |
| 48 /* Remove all instances of substring ss in string s, modifying s in place. */ | |
| 49 void CleanString(char *s, const char *ss); | |
| 50 | |
| 51 /* Remove all instances of character c in string s. */ | |
| 52 void strnzapchar(char *s, const char c); | |
| 53 | |
| 54 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ */ | |
| OLD | NEW |