Exemplo n.º 1
0
Arquivo: reader.c Projeto: YauzZ/upb
// Qualify the defname for all defs starting with offset "start" with "str".
static void upb_deflist_qualify(upb_deflist *l, char *str, int32_t start) {
  for (uint32_t i = start; i < l->len; i++) {
    upb_def *def = l->defs[i];
    char *name = upb_join(str, upb_def_fullname(def));
    upb_def_setfullname(def, name, NULL);
    free(name);
  }
}
Exemplo n.º 2
0
static size_t enum_onname(void *_r, void *fval, const char *buf, size_t n) {
  UPB_UNUSED(fval);
  upb_descreader *r = _r;
  // XXX: see comment at the top of the file.
  char *fullname = upb_strndup(buf, n);
  upb_def_setfullname(upb_descreader_last(r), fullname);
  free(fullname);
  return n;
}
Exemplo n.º 3
0
static size_t msg_onname(void *_r, void *fval, const char *buf, size_t n) {
  UPB_UNUSED(fval);
  upb_descreader *r = _r;
  upb_msgdef *m = upb_descreader_top(r);
  // XXX: see comment at the top of the file.
  char *name = upb_strndup(buf, n);
  upb_def_setfullname(upb_upcast(m), name);
  upb_descreader_setscopename(r, name);  // Passes ownership of name.
  return n;
}
Exemplo n.º 4
0
Arquivo: reader.c Projeto: YauzZ/upb
static size_t enum_onname(void *closure, const void *hd, const char *buf,
                          size_t n, const upb_bufhandle *handle) {
  UPB_UNUSED(hd);
  UPB_UNUSED(handle);
  upb_descreader *r = closure;
  // XXX: see comment at the top of the file.
  char *fullname = upb_strndup(buf, n);
  upb_def_setfullname(upb_descreader_last(r), fullname, NULL);
  free(fullname);
  return n;
}
Exemplo n.º 5
0
Arquivo: reader.c Projeto: YauzZ/upb
static size_t msg_onname(void *closure, const void *hd, const char *buf,
                         size_t n, const upb_bufhandle *handle) {
  UPB_UNUSED(hd);
  UPB_UNUSED(handle);
  upb_descreader *r = closure;
  upb_msgdef *m = upb_descreader_top(r);
  // XXX: see comment at the top of the file.
  char *name = upb_strndup(buf, n);
  upb_def_setfullname(UPB_UPCAST(m), name, NULL);
  upb_descreader_setscopename(r, name);  // Passes ownership of name.
  return n;
}
Exemplo n.º 6
0
upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner) {
  upb_msgdef *newm = upb_msgdef_new(owner);
  if (!newm) return NULL;
  upb_def_setfullname(upb_upcast(newm), upb_def_fullname(upb_upcast(m)));
  upb_msg_iter i;
  for(upb_msg_begin(&i, m); !upb_msg_done(&i); upb_msg_next(&i)) {
    upb_fielddef *f = upb_fielddef_dup(upb_msg_iter_field(&i), &f);
    if (!f || !upb_msgdef_addfield(newm, f, &f)) {
      upb_msgdef_unref(newm, owner);
      return NULL;
    }
  }
  return newm;
}
Exemplo n.º 7
0
Arquivo: def.c Projeto: YauzZ/upb
upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner) {
  upb_msgdef *newm = upb_msgdef_new(owner);
  if (!newm) return NULL;
  bool ok = upb_def_setfullname(UPB_UPCAST(newm),
                                upb_def_fullname(UPB_UPCAST(m)), NULL);
  UPB_ASSERT_VAR(ok, ok);
  upb_msg_iter i;
  for(upb_msg_begin(&i, m); !upb_msg_done(&i); upb_msg_next(&i)) {
    upb_fielddef *f = upb_fielddef_dup(upb_msg_iter_field(&i), &f);
    if (!f || !upb_msgdef_addfield(newm, f, &f, NULL)) {
      upb_msgdef_unref(newm, owner);
      return NULL;
    }
  }
  return newm;
}
Exemplo n.º 8
0
Arquivo: def.c Projeto: Phuehvk/upb
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname,
                            upb_status *s) {
  return upb_def_setfullname(upb_upcast(m), fullname, s);
}
Exemplo n.º 9
0
Arquivo: def.c Projeto: Phuehvk/upb
bool upb_fielddef_setname(upb_fielddef *f, const char *name, upb_status *s) {
  return upb_def_setfullname(upb_upcast(f), name, s);
}
Exemplo n.º 10
0
Arquivo: def.c Projeto: Phuehvk/upb
bool upb_enumdef_setfullname(upb_enumdef *e, const char *fullname,
                             upb_status *s) {
  return upb_def_setfullname(upb_upcast(e), fullname, s);
}
Exemplo n.º 11
0
Arquivo: def.c Projeto: YauzZ/upb
bool upb_fielddef_setname(upb_fielddef *f, const char *name, upb_status *s) {
  return upb_def_setfullname(UPB_UPCAST(f), name, s);
}
Exemplo n.º 12
0
Arquivo: def.c Projeto: YauzZ/upb
bool upb_enumdef_setfullname(upb_enumdef *e, const char *fullname,
                             upb_status *s) {
  return upb_def_setfullname(UPB_UPCAST(e), fullname, s);
}
Exemplo n.º 13
0
Arquivo: def.c Projeto: YauzZ/upb
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname,
                            upb_status *s) {
  return upb_def_setfullname(UPB_UPCAST(m), fullname, s);
}
Exemplo n.º 14
0
bool upb_msgdef_setfullname(upb_msgdef *m, const char *fullname) {
  return upb_def_setfullname(upb_upcast(m), fullname);
}
Exemplo n.º 15
0
bool upb_fielddef_setname(upb_fielddef *f, const char *name) {
  return upb_def_setfullname(upb_upcast(f), name);
}
Exemplo n.º 16
0
bool upb_enumdef_setfullname(upb_enumdef *e, const char *fullname) {
  return upb_def_setfullname(upb_upcast(e), fullname);
}