summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-08-30 20:06:25 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-08-30 20:06:25 -0700
commit75134e6f9dc24282e749045d5322b2277c32e9f4 (patch)
treec4ae7b87080a17d165c2316387c14593dedf0f8c /benchmarks
parent9b67b322da57f1d454500e1156f6520835165386 (diff)
Small stylistic improvements in benchmarks.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/parsetostruct.proto2_compiled.cc2
-rw-r--r--benchmarks/parsetostruct.proto2_table.cc4
-rw-r--r--benchmarks/parsetostruct.upb_table.c14
3 files changed, 9 insertions, 11 deletions
diff --git a/benchmarks/parsetostruct.proto2_compiled.cc b/benchmarks/parsetostruct.proto2_compiled.cc
index 4091ed0..f5f02bf 100644
--- a/benchmarks/parsetostruct.proto2_compiled.cc
+++ b/benchmarks/parsetostruct.proto2_compiled.cc
@@ -11,7 +11,7 @@ MESSAGE_CIDENT msg[NUM_MESSAGES];
static bool initialize()
{
- /* Read the message data itself. */
+ // Read the message data itself. */
std::ifstream stream(MESSAGE_FILE);
if(!stream.is_open()) {
fprintf(stderr, "Error opening " MESSAGE_FILE ".\n");
diff --git a/benchmarks/parsetostruct.proto2_table.cc b/benchmarks/parsetostruct.proto2_table.cc
index ded267d..49a5b16 100644
--- a/benchmarks/parsetostruct.proto2_table.cc
+++ b/benchmarks/parsetostruct.proto2_table.cc
@@ -12,7 +12,7 @@ static google::protobuf::Message *msg[NUM_MESSAGES];
static bool initialize()
{
- /* Read the message data itself. */
+ // Read the message data itself.
std::ifstream stream(MESSAGE_FILE);
if(!stream.is_open()) {
fprintf(stderr, "Error opening " MESSAGE_FILE ".\n");
@@ -22,7 +22,7 @@ static bool initialize()
stringstream << stream.rdbuf();
str = stringstream.str();
- /* Create the DynamicMessage. */
+ // Create the DynamicMessage.
const google::protobuf::Message *dynamic_msg_prototype =
factory.GetPrototype(MESSAGE_CIDENT::descriptor());
for(int i = 0; i < NUM_MESSAGES; i++)
diff --git a/benchmarks/parsetostruct.upb_table.c b/benchmarks/parsetostruct.upb_table.c
index 9daa8e0..b86b318 100644
--- a/benchmarks/parsetostruct.upb_table.c
+++ b/benchmarks/parsetostruct.upb_table.c
@@ -12,7 +12,7 @@ static struct upb_msg *msgs[NUM_MESSAGES];
static bool initialize()
{
- /* Initialize upb state, parse descriptor. */
+ // Initialize upb state, parse descriptor.
c = upb_context_new();
struct upb_string *fds = upb_strreadfile(MESSAGE_DESCRIPTOR_FILE);
if(!fds) {
@@ -25,23 +25,21 @@ static bool initialize()
}
upb_string_unref(fds);
- char class_name[] = MESSAGE_NAME;
- struct upb_string proto_name;
- proto_name.ptr = class_name;
- proto_name.byte_len = sizeof(class_name)-1;
+ struct upb_string *proto_name = upb_strdupc(MESSAGE_NAME);
struct upb_symtab_entry e;
- upb_status_t success = upb_context_lookup(c, &proto_name, &e);
+ upb_status_t success = upb_context_lookup(c, proto_name, &e);
if(!success || e.type != UPB_SYM_MESSAGE) {
fprintf(stderr, "Error finding symbol '" UPB_STRFMT "'.\n",
- UPB_STRARG(&proto_name));
+ UPB_STRARG(proto_name));
return false;
}
+ upb_string_unref(proto_name);
def = e.ref.msg;
for(int i = 0; i < 32; i++)
msgs[i] = upb_msg_new(def);
- /* Read the message data itself. */
+ // Read the message data itself.
str = upb_strreadfile(MESSAGE_FILE);
if(!str) {
fprintf(stderr, "Error reading " MESSAGE_FILE "\n");
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback