diff options
author | Craig Tiller <ctiller@google.com> | 2016-10-26 21:08:10 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-10-26 21:08:10 -0700 |
commit | 618e67d655d8a0a345463d6e3e690e258dadd763 (patch) | |
tree | a886d8746523a58d9e6f42d31a99b2c943fdb2e4 /src/core/lib/slice | |
parent | 2d75209fa8f3e43e4b7994b99b7d09e5116402ab (diff) |
s/GPR_SLICE/GRPC_SLICE/g
Diffstat (limited to 'src/core/lib/slice')
-rw-r--r-- | src/core/lib/slice/percent_encoding.c | 28 | ||||
-rw-r--r-- | src/core/lib/slice/slice.c | 14 | ||||
-rw-r--r-- | src/core/lib/slice/slice_buffer.c | 22 | ||||
-rw-r--r-- | src/core/lib/slice/slice_string_helpers.c | 8 |
4 files changed, 36 insertions, 36 deletions
diff --git a/src/core/lib/slice/percent_encoding.c b/src/core/lib/slice/percent_encoding.c index 19f5f96cc3..b9e35f1c71 100644 --- a/src/core/lib/slice/percent_encoding.c +++ b/src/core/lib/slice/percent_encoding.c @@ -55,8 +55,8 @@ grpc_slice grpc_percent_encode_slice(grpc_slice slice, // first pass: count the number of bytes needed to output this string size_t output_length = 0; - const uint8_t *slice_start = GPR_SLICE_START_PTR(slice); - const uint8_t *slice_end = GPR_SLICE_END_PTR(slice); + const uint8_t *slice_start = GRPC_SLICE_START_PTR(slice); + const uint8_t *slice_end = GRPC_SLICE_END_PTR(slice); const uint8_t *p; bool any_reserved_bytes = false; for (p = slice_start; p < slice_end; p++) { @@ -70,7 +70,7 @@ grpc_slice grpc_percent_encode_slice(grpc_slice slice, } // second pass: actually encode grpc_slice out = grpc_slice_malloc(output_length); - uint8_t *q = GPR_SLICE_START_PTR(out); + uint8_t *q = GRPC_SLICE_START_PTR(out); for (p = slice_start; p < slice_end; p++) { if (is_unreserved_character(*p, unreserved_bytes)) { *q++ = *p; @@ -80,7 +80,7 @@ grpc_slice grpc_percent_encode_slice(grpc_slice slice, *q++ = hex[*p & 15]; } } - GPR_ASSERT(q == GPR_SLICE_END_PTR(out)); + GPR_ASSERT(q == GRPC_SLICE_END_PTR(out)); return out; } @@ -100,8 +100,8 @@ static uint8_t dehex(uint8_t c) { bool grpc_strict_percent_decode_slice(grpc_slice slice_in, const uint8_t *unreserved_bytes, grpc_slice *slice_out) { - const uint8_t *p = GPR_SLICE_START_PTR(slice_in); - const uint8_t *in_end = GPR_SLICE_END_PTR(slice_in); + const uint8_t *p = GRPC_SLICE_START_PTR(slice_in); + const uint8_t *in_end = GRPC_SLICE_END_PTR(slice_in); size_t out_length = 0; bool any_percent_encoded_stuff = false; while (p != in_end) { @@ -122,9 +122,9 @@ bool grpc_strict_percent_decode_slice(grpc_slice slice_in, *slice_out = grpc_slice_ref(slice_in); return true; } - p = GPR_SLICE_START_PTR(slice_in); + p = GRPC_SLICE_START_PTR(slice_in); *slice_out = grpc_slice_malloc(out_length); - uint8_t *q = GPR_SLICE_START_PTR(*slice_out); + uint8_t *q = GRPC_SLICE_START_PTR(*slice_out); while (p != in_end) { if (*p == '%') { *q++ = (uint8_t)(dehex(p[1]) << 4) | (dehex(p[2])); @@ -133,13 +133,13 @@ bool grpc_strict_percent_decode_slice(grpc_slice slice_in, *q++ = *p++; } } - GPR_ASSERT(q == GPR_SLICE_END_PTR(*slice_out)); + GPR_ASSERT(q == GRPC_SLICE_END_PTR(*slice_out)); return true; } grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in) { - const uint8_t *p = GPR_SLICE_START_PTR(slice_in); - const uint8_t *in_end = GPR_SLICE_END_PTR(slice_in); + const uint8_t *p = GRPC_SLICE_START_PTR(slice_in); + const uint8_t *in_end = GRPC_SLICE_END_PTR(slice_in); size_t out_length = 0; bool any_percent_encoded_stuff = false; while (p != in_end) { @@ -160,9 +160,9 @@ grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in) { if (!any_percent_encoded_stuff) { return grpc_slice_ref(slice_in); } - p = GPR_SLICE_START_PTR(slice_in); + p = GRPC_SLICE_START_PTR(slice_in); grpc_slice out = grpc_slice_malloc(out_length); - uint8_t *q = GPR_SLICE_START_PTR(out); + uint8_t *q = GRPC_SLICE_START_PTR(out); while (p != in_end) { if (*p == '%') { if (!valid_hex(p + 1, in_end) || !valid_hex(p + 2, in_end)) { @@ -175,6 +175,6 @@ grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in) { *q++ = *p++; } } - GPR_ASSERT(q == GPR_SLICE_END_PTR(out)); + GPR_ASSERT(q == GRPC_SLICE_END_PTR(out)); return out; } diff --git a/src/core/lib/slice/slice.c b/src/core/lib/slice/slice.c index 1db1211938..54ff6f6baa 100644 --- a/src/core/lib/slice/slice.c +++ b/src/core/lib/slice/slice.c @@ -159,7 +159,7 @@ grpc_slice grpc_slice_new_with_len(void *p, size_t len, grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t length) { grpc_slice slice = grpc_slice_malloc(length); - memcpy(GPR_SLICE_START_PTR(slice), source, length); + memcpy(GRPC_SLICE_START_PTR(slice), source, length); return slice; } @@ -252,7 +252,7 @@ grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) { if (end - begin <= sizeof(subset.data.inlined.bytes)) { subset.refcount = NULL; subset.data.inlined.length = (uint8_t)(end - begin); - memcpy(subset.data.inlined.bytes, GPR_SLICE_START_PTR(source) + begin, + memcpy(subset.data.inlined.bytes, GRPC_SLICE_START_PTR(source) + begin, end - begin); } else { subset = grpc_slice_sub_no_ref(source, begin, end); @@ -336,15 +336,15 @@ grpc_slice grpc_slice_split_head(grpc_slice *source, size_t split) { } int grpc_slice_cmp(grpc_slice a, grpc_slice b) { - int d = (int)(GPR_SLICE_LENGTH(a) - GPR_SLICE_LENGTH(b)); + int d = (int)(GRPC_SLICE_LENGTH(a) - GRPC_SLICE_LENGTH(b)); if (d != 0) return d; - return memcmp(GPR_SLICE_START_PTR(a), GPR_SLICE_START_PTR(b), - GPR_SLICE_LENGTH(a)); + return memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b), + GRPC_SLICE_LENGTH(a)); } int grpc_slice_str_cmp(grpc_slice a, const char *b) { size_t b_length = strlen(b); - int d = (int)(GPR_SLICE_LENGTH(a) - b_length); + int d = (int)(GRPC_SLICE_LENGTH(a) - b_length); if (d != 0) return d; - return memcmp(GPR_SLICE_START_PTR(a), b, b_length); + return memcmp(GRPC_SLICE_START_PTR(a), b, b_length); } diff --git a/src/core/lib/slice/slice_buffer.c b/src/core/lib/slice/slice_buffer.c index a18309f3c4..8416237631 100644 --- a/src/core/lib/slice/slice_buffer.c +++ b/src/core/lib/slice/slice_buffer.c @@ -98,7 +98,7 @@ size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb, grpc_slice s) { size_t out = sb->count; maybe_embiggen(sb); sb->slices[out] = s; - sb->length += GPR_SLICE_LENGTH(s); + sb->length += GRPC_SLICE_LENGTH(s); sb->count = out + 1; return out; } @@ -112,18 +112,18 @@ void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice s) { writes */ if (!s.refcount && n) { grpc_slice *back = &sb->slices[n - 1]; - if (!back->refcount && back->data.inlined.length < GPR_SLICE_INLINED_SIZE) { + if (!back->refcount && back->data.inlined.length < GRPC_SLICE_INLINED_SIZE) { if (s.data.inlined.length + back->data.inlined.length <= - GPR_SLICE_INLINED_SIZE) { + GRPC_SLICE_INLINED_SIZE) { memcpy(back->data.inlined.bytes + back->data.inlined.length, s.data.inlined.bytes, s.data.inlined.length); back->data.inlined.length = (uint8_t)(back->data.inlined.length + s.data.inlined.length); } else { - size_t cp1 = GPR_SLICE_INLINED_SIZE - back->data.inlined.length; + size_t cp1 = GRPC_SLICE_INLINED_SIZE - back->data.inlined.length; memcpy(back->data.inlined.bytes + back->data.inlined.length, s.data.inlined.bytes, cp1); - back->data.inlined.length = GPR_SLICE_INLINED_SIZE; + back->data.inlined.length = GRPC_SLICE_INLINED_SIZE; maybe_embiggen(sb); back = &sb->slices[n]; sb->count = n + 1; @@ -149,7 +149,7 @@ void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *s, size_t n) { void grpc_slice_buffer_pop(grpc_slice_buffer *sb) { if (sb->count != 0) { size_t count = --sb->count; - sb->length -= GPR_SLICE_LENGTH(sb->slices[count]); + sb->length -= GRPC_SLICE_LENGTH(sb->slices[count]); } } @@ -222,7 +222,7 @@ void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n, src_idx = 0; while (src_idx < src->capacity) { grpc_slice slice = src->slices[src_idx]; - size_t slice_len = GPR_SLICE_LENGTH(slice); + size_t slice_len = GRPC_SLICE_LENGTH(slice); if (n > slice_len) { grpc_slice_buffer_add(dst, slice); n -= slice_len; @@ -233,8 +233,8 @@ void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n, break; } else { /* n < slice_len */ src->slices[src_idx] = grpc_slice_split_tail(&slice, n); - GPR_ASSERT(GPR_SLICE_LENGTH(slice) == n); - GPR_ASSERT(GPR_SLICE_LENGTH(src->slices[src_idx]) == slice_len - n); + GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == n); + GPR_ASSERT(GRPC_SLICE_LENGTH(src->slices[src_idx]) == slice_len - n); grpc_slice_buffer_add(dst, slice); break; } @@ -254,7 +254,7 @@ void grpc_slice_buffer_trim_end(grpc_slice_buffer *sb, size_t n, for (;;) { size_t idx = sb->count - 1; grpc_slice slice = sb->slices[idx]; - size_t slice_len = GPR_SLICE_LENGTH(slice); + size_t slice_len = GRPC_SLICE_LENGTH(slice); if (slice_len > n) { sb->slices[idx] = grpc_slice_split_head(&slice, slice_len - n); grpc_slice_buffer_add_indexed(garbage, slice); @@ -277,6 +277,6 @@ grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *sb) { slice = sb->slices[0]; memmove(&sb->slices[0], &sb->slices[1], (sb->count - 1) * sizeof(grpc_slice)); sb->count--; - sb->length -= GPR_SLICE_LENGTH(slice); + sb->length -= GRPC_SLICE_LENGTH(slice); return slice; } diff --git a/src/core/lib/slice/slice_string_helpers.c b/src/core/lib/slice/slice_string_helpers.c index eaffb63686..4731762ece 100644 --- a/src/core/lib/slice/slice_string_helpers.c +++ b/src/core/lib/slice/slice_string_helpers.c @@ -40,7 +40,7 @@ #include "src/core/lib/support/string.h" char *grpc_dump_slice(grpc_slice s, uint32_t flags) { - return gpr_dump((const char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s), + return gpr_dump((const char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s), flags); } @@ -53,8 +53,8 @@ static int slice_find_separator_offset(const grpc_slice str, const char *sep, const size_t read_offset, size_t *begin, size_t *end) { size_t i; - const uint8_t *str_ptr = GPR_SLICE_START_PTR(str) + read_offset; - const size_t str_len = GPR_SLICE_LENGTH(str) - read_offset; + const uint8_t *str_ptr = GRPC_SLICE_START_PTR(str) + read_offset; + const size_t str_len = GRPC_SLICE_LENGTH(str) - read_offset; const size_t sep_len = strlen(sep); if (str_len < sep_len) { return 0; @@ -82,7 +82,7 @@ void grpc_slice_split(grpc_slice str, const char *sep, grpc_slice_buffer *dst) { } while (slice_find_separator_offset(str, sep, end + sep_len, &begin, &end) != 0); grpc_slice_buffer_add_indexed( - dst, grpc_slice_sub(str, end + sep_len, GPR_SLICE_LENGTH(str))); + dst, grpc_slice_sub(str, end + sep_len, GRPC_SLICE_LENGTH(str))); } else { /* no sep found, add whole input */ grpc_slice_buffer_add_indexed(dst, grpc_slice_ref(str)); } |