From 462b26c1cc041a8fa26deb62cf12f1f351a5b2f6 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 8 Jul 2009 12:06:47 -0700 Subject: Directory restructuring. --- upb_enum.c | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 upb_enum.c (limited to 'upb_enum.c') diff --git a/upb_enum.c b/upb_enum.c deleted file mode 100644 index b599c9b..0000000 --- a/upb_enum.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Joshua Haberman. See LICENSE for details. - */ - -#include "descriptor.h" -#include "upb_enum.h" - -void upb_enum_init(struct upb_enum *e, - struct google_protobuf_EnumDescriptorProto *ed) { - int num_values = ed->set_flags.has.value ? ed->value->len : 0; - e->descriptor = ed; - upb_strtable_init(&e->nametoint, num_values, sizeof(struct upb_enum_ntoi_entry)); - upb_inttable_init(&e->inttoname, num_values, sizeof(struct upb_enum_iton_entry)); - - for(int i = 0; i < num_values; i++) { - google_protobuf_EnumValueDescriptorProto *value = ed->value->elements[i]; - struct upb_enum_ntoi_entry ntoi_entry = {.e = {.key = *value->name}, - .value = value->number}; - struct upb_enum_iton_entry iton_entry = {.e = {.key = value->number}, - .string = value->name}; - upb_strtable_insert(&e->nametoint, &ntoi_entry.e); - upb_inttable_insert(&e->inttoname, &iton_entry.e); - } -} - -void upb_enum_free(struct upb_enum *e) { - upb_strtable_free(&e->nametoint); - upb_inttable_free(&e->inttoname); -} -- cgit v1.2.3