OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 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 | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * str_utils.h | 8 * str_utils.h |
9 * | 9 * |
10 * Defines support string routines for the instruction enumerator. | 10 * Defines support string routines for the instruction enumerator. |
11 */ | 11 */ |
12 | 12 |
13 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ | 13 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ |
14 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ | 14 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ |
15 | 15 |
16 #include "native_client/src/include/nacl_macros.h" | 16 #include "native_client/src/include/nacl_macros.h" |
17 | 17 |
18 /* If string s begins with string prefix, return a pointer to the | 18 /* If string s begins with string prefix, return a pointer to the |
19 * first byte after the prefix. Else return s. | 19 * first byte after the prefix. Else return s. |
20 */ | 20 */ |
21 char *SkipPrefix(char *s, const char *prefix); | 21 char *SkipPrefix(char *s, const char *prefix); |
22 | 22 |
23 /* Return a pointer to s with leading spaces removed. */ | 23 /* Return a pointer to s with leading spaces removed. */ |
24 char *strip(char *s); | 24 const char *strip(const char *s); |
25 | 25 |
26 /* Updates the string by removing trailing spaces/newlines. */ | 26 /* Updates the string by removing trailing spaces/newlines. */ |
27 void rstrip(char *s); | 27 void rstrip(char *s); |
28 | 28 |
29 /* Find substring ss in string s. Returns a pointer to the substring | 29 /* Find substring ss in string s. Returns a pointer to the substring |
30 * on success, NULL on failure. | 30 * on success, NULL on failure. |
31 */ | 31 */ |
32 const char *strfind(const char *s, const char *ss); | 32 const char *strfind(const char *s, const char *ss); |
33 | 33 |
34 /* If string ss appears in string s, return a pointer to the first byte | 34 /* If string ss appears in string s, return a pointer to the first byte |
(...skipping 10 matching lines...) Expand all Loading... |
45 /* Copy src to dest, stoping at character c. */ | 45 /* Copy src to dest, stoping at character c. */ |
46 void strncpyto(char *dest, const char *src, size_t n, char c); | 46 void strncpyto(char *dest, const char *src, size_t n, char c); |
47 | 47 |
48 /* Remove all instances of substring ss in string s, modifying s in place. */ | 48 /* Remove all instances of substring ss in string s, modifying s in place. */ |
49 void CleanString(char *s, const char *ss); | 49 void CleanString(char *s, const char *ss); |
50 | 50 |
51 /* Remove all instances of character c in string s. */ | 51 /* Remove all instances of character c in string s. */ |
52 void strnzapchar(char *s, const char c); | 52 void strnzapchar(char *s, const char c); |
53 | 53 |
54 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ */ | 54 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_TESTING_STR_UTILS_H__ */ |
OLD | NEW |