summaryrefslogtreecommitdiff
path: root/upb/pb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-01-15 07:14:48 -0800
committerJoshua Haberman <jhaberman@gmail.com>2019-01-15 07:14:48 -0800
commitf30c7f4acbe0457aa41597f034765d94eb39e739 (patch)
tree4930a8db88267b3497177b54c2220ac95b988e42 /upb/pb
parent9ae5a3af5be8650950c9647b121f23c3a8ae8e83 (diff)
Take sinks by value.
Diffstat (limited to 'upb/pb')
-rw-r--r--upb/pb/decoder.c22
-rw-r--r--upb/pb/encoder.c6
-rw-r--r--upb/pb/textprinter.c16
3 files changed, 22 insertions, 22 deletions
diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c
index f1617db..2384312 100644
--- a/upb/pb/decoder.c
+++ b/upb/pb/decoder.c
@@ -594,7 +594,7 @@ have_tag:
if (d->top->groupnum >= 0) {
/* TODO: More code needed for handling unknown groups. */
- upb_sink_putunknown(&d->top->sink, d->checkpoint, d->ptr - d->checkpoint);
+ upb_sink_putunknown(d->top->sink, d->checkpoint, d->ptr - d->checkpoint);
return DECODE_OK;
}
@@ -688,7 +688,7 @@ size_t run_decoder_vm(upb_pbdecoder *d, const mgroup *group,
VMCASE(OP_PARSE_ ## type, { \
ctype val; \
CHECK_RETURN(decode_ ## wt(d, &val)); \
- upb_sink_put ## name(&d->top->sink, arg, (convfunc)(val)); \
+ upb_sink_put ## name(d->top->sink, arg, (convfunc)(val)); \
})
while(1) {
@@ -740,36 +740,36 @@ size_t run_decoder_vm(upb_pbdecoder *d, const mgroup *group,
d->pc += sizeof(void*) / sizeof(uint32_t);
)
VMCASE(OP_STARTMSG,
- CHECK_SUSPEND(upb_sink_startmsg(&d->top->sink));
+ CHECK_SUSPEND(upb_sink_startmsg(d->top->sink));
)
VMCASE(OP_ENDMSG,
- CHECK_SUSPEND(upb_sink_endmsg(&d->top->sink, d->status));
+ CHECK_SUSPEND(upb_sink_endmsg(d->top->sink, d->status));
)
VMCASE(OP_STARTSEQ,
upb_pbdecoder_frame *outer = outer_frame(d);
- CHECK_SUSPEND(upb_sink_startseq(&outer->sink, arg, &d->top->sink));
+ CHECK_SUSPEND(upb_sink_startseq(outer->sink, arg, &d->top->sink));
)
VMCASE(OP_ENDSEQ,
- CHECK_SUSPEND(upb_sink_endseq(&d->top->sink, arg));
+ CHECK_SUSPEND(upb_sink_endseq(d->top->sink, arg));
)
VMCASE(OP_STARTSUBMSG,
upb_pbdecoder_frame *outer = outer_frame(d);
- CHECK_SUSPEND(upb_sink_startsubmsg(&outer->sink, arg, &d->top->sink));
+ CHECK_SUSPEND(upb_sink_startsubmsg(outer->sink, arg, &d->top->sink));
)
VMCASE(OP_ENDSUBMSG,
- CHECK_SUSPEND(upb_sink_endsubmsg(&d->top->sink, arg));
+ CHECK_SUSPEND(upb_sink_endsubmsg(d->top->sink, arg));
)
VMCASE(OP_STARTSTR,
uint32_t len = delim_remaining(d);
upb_pbdecoder_frame *outer = outer_frame(d);
- CHECK_SUSPEND(upb_sink_startstr(&outer->sink, arg, len, &d->top->sink));
+ CHECK_SUSPEND(upb_sink_startstr(outer->sink, arg, len, &d->top->sink));
if (len == 0) {
d->pc++; /* Skip OP_STRING. */
}
)
VMCASE(OP_STRING,
uint32_t len = curbufleft(d);
- size_t n = upb_sink_putstring(&d->top->sink, arg, d->ptr, len, handle);
+ size_t n = upb_sink_putstring(d->top->sink, arg, d->ptr, len, handle);
if (n > len) {
if (n > delim_remaining(d)) {
seterr(d, "Tried to skip past end of string.");
@@ -790,7 +790,7 @@ size_t run_decoder_vm(upb_pbdecoder *d, const mgroup *group,
}
)
VMCASE(OP_ENDSTR,
- CHECK_SUSPEND(upb_sink_endstr(&d->top->sink, arg));
+ CHECK_SUSPEND(upb_sink_endstr(d->top->sink, arg));
)
VMCASE(OP_PUSHTAGDELIM,
CHECK_SUSPEND(pushtagdelim(d, arg));
diff --git a/upb/pb/encoder.c b/upb/pb/encoder.c
index 722cc5b..2da34db 100644
--- a/upb/pb/encoder.c
+++ b/upb/pb/encoder.c
@@ -127,7 +127,7 @@ struct upb_pb_encoder {
/* TODO(haberman): handle pushback */
static void putbuf(upb_pb_encoder *e, const char *buf, size_t len) {
- size_t n = upb_bytessink_putbuf(&e->output_, e->subc, buf, len, NULL);
+ size_t n = upb_bytessink_putbuf(e->output_, e->subc, buf, len, NULL);
UPB_ASSERT(n == len);
}
@@ -353,7 +353,7 @@ static bool startmsg(void *c, const void *hd) {
upb_pb_encoder *e = c;
UPB_UNUSED(hd);
if (e->depth++ == 0) {
- upb_bytessink_start(&e->output_, 0, &e->subc);
+ upb_bytessink_start(e->output_, 0, &e->subc);
}
return true;
}
@@ -363,7 +363,7 @@ static bool endmsg(void *c, const void *hd, upb_status *status) {
UPB_UNUSED(hd);
UPB_UNUSED(status);
if (--e->depth == 0) {
- upb_bytessink_end(&e->output_);
+ upb_bytessink_end(e->output_);
}
return true;
}
diff --git a/upb/pb/textprinter.c b/upb/pb/textprinter.c
index 91d0d55..934130e 100644
--- a/upb/pb/textprinter.c
+++ b/upb/pb/textprinter.c
@@ -35,13 +35,13 @@ static int indent(upb_textprinter *p) {
int i;
if (!p->single_line_)
for (i = 0; i < p->indent_depth_; i++)
- upb_bytessink_putbuf(&p->output_, p->subc, " ", 2, NULL);
+ upb_bytessink_putbuf(p->output_, p->subc, " ", 2, NULL);
return 0;
}
static int endfield(upb_textprinter *p) {
const char ch = (p->single_line_ ? ' ' : '\n');
- upb_bytessink_putbuf(&p->output_, p->subc, &ch, 1, NULL);
+ upb_bytessink_putbuf(p->output_, p->subc, &ch, 1, NULL);
return 0;
}
@@ -60,7 +60,7 @@ static int putescaped(upb_textprinter *p, const char *buf, size_t len,
bool is_hex_escape;
if (dstend - dst < 4) {
- upb_bytessink_putbuf(&p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
+ upb_bytessink_putbuf(p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
dst = dstbuf;
}
@@ -88,7 +88,7 @@ static int putescaped(upb_textprinter *p, const char *buf, size_t len,
last_hex_escape = is_hex_escape;
}
/* Flush remaining data. */
- upb_bytessink_putbuf(&p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
+ upb_bytessink_putbuf(p->output_, p->subc, dstbuf, dst - dstbuf, NULL);
return 0;
}
@@ -114,7 +114,7 @@ bool putf(upb_textprinter *p, const char *fmt, ...) {
va_end(args);
UPB_ASSERT(written == len);
- ok = upb_bytessink_putbuf(&p->output_, p->subc, str, len, NULL);
+ ok = upb_bytessink_putbuf(p->output_, p->subc, str, len, NULL);
upb_gfree(str);
return ok;
}
@@ -126,7 +126,7 @@ static bool textprinter_startmsg(void *c, const void *hd) {
upb_textprinter *p = c;
UPB_UNUSED(hd);
if (p->indent_depth_ == 0) {
- upb_bytessink_start(&p->output_, 0, &p->subc);
+ upb_bytessink_start(p->output_, 0, &p->subc);
}
return true;
}
@@ -136,7 +136,7 @@ static bool textprinter_endmsg(void *c, const void *hd, upb_status *s) {
UPB_UNUSED(hd);
UPB_UNUSED(s);
if (p->indent_depth_ == 0) {
- upb_bytessink_end(&p->output_);
+ upb_bytessink_end(p->output_);
}
return true;
}
@@ -241,7 +241,7 @@ static bool textprinter_endsubmsg(void *closure, const void *handler_data) {
UPB_UNUSED(handler_data);
p->indent_depth_--;
CHECK(indent(p));
- upb_bytessink_putbuf(&p->output_, p->subc, "}", 1, NULL);
+ upb_bytessink_putbuf(p->output_, p->subc, "}", 1, NULL);
CHECK(endfield(p));
return true;
err:
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback