Brought into compliance with Google open-source policies.

- removed myself from Author headers in source files.
- removed copyright notices from source file headers.
- added CONTRIBUTING.md
pull/13171/head
Josh Haberman 10 years ago
parent 6d9a9c727f
commit 49dab06e03
  1. 7
      CONTRIBUTING.md
  2. 3
      tests/bindings/googlepb/test_vs_proto2.cc
  3. 3
      tests/json/test_json.cc
  4. 3
      tests/pb/test_decoder.cc
  5. 5
      tests/pb/test_varint.c
  6. 4
      tests/test_cpp.cc
  7. 10
      tests/test_def.c
  8. 6
      tests/test_handlers.c
  9. 3
      tests/test_table.cc
  10. 8
      tests/test_util.h
  11. 2
      tests/testmain.cc
  12. 5
      tests/upb_test.h
  13. 7
      upb/bindings/googlepb/bridge.cc
  14. 7
      upb/bindings/googlepb/bridge.h
  15. 5
      upb/bindings/googlepb/proto1.cc
  16. 6
      upb/bindings/googlepb/proto1.int.h
  17. 5
      upb/bindings/googlepb/proto2.cc
  18. 6
      upb/bindings/googlepb/proto2.int.h
  19. 6
      upb/bindings/linux/assert.h
  20. 6
      upb/bindings/linux/errno.h
  21. 6
      upb/bindings/linux/stdint.h
  22. 8
      upb/bindings/linux/stdio.h
  23. 9
      upb/bindings/linux/stdlib.h
  24. 6
      upb/bindings/linux/string.h
  25. 43
      upb/bindings/lua/upb.c
  26. 9
      upb/bindings/lua/upb.h
  27. 15
      upb/bindings/lua/upb/pb.c
  28. 30
      upb/bindings/lua/upb/table.c
  29. 11
      upb/bindings/python/upb.c
  30. 9
      upb/bindings/ruby/upb.c
  31. 4
      upb/bindings/stdc++/string.h
  32. 9
      upb/bindings/stdc/error.c
  33. 9
      upb/bindings/stdc/error.h
  34. 6
      upb/bindings/stdc/io.c
  35. 9
      upb/bindings/stdc/io.h
  36. 6
      upb/def.c
  37. 36
      upb/def.h
  38. 17
      upb/descriptor/reader.c
  39. 12
      upb/descriptor/reader.h
  40. 6
      upb/env.c
  41. 27
      upb/env.h
  42. 11
      upb/handlers-inl.h
  43. 11
      upb/handlers.c
  44. 35
      upb/handlers.h
  45. 13
      upb/json/parser.h
  46. 11
      upb/json/printer.c
  47. 12
      upb/json/printer.h
  48. 27
      upb/pb/compile_decoder.c
  49. 9
      upb/pb/compile_decoder_x64.c
  50. 31
      upb/pb/decoder.c
  51. 27
      upb/pb/decoder.h
  52. 9
      upb/pb/decoder.int.h
  53. 111
      upb/pb/encoder.c
  54. 21
      upb/pb/encoder.h
  55. 6
      upb/pb/glue.c
  56. 41
      upb/pb/glue.h
  57. 5
      upb/pb/textprinter.c
  58. 9
      upb/pb/textprinter.h
  59. 6
      upb/pb/varint.c
  60. 11
      upb/pb/varint.int.h
  61. 33
      upb/refcounted.c
  62. 29
      upb/refcounted.h
  63. 6
      upb/shim/shim.c
  64. 25
      upb/shim/shim.h
  65. 32
      upb/sink.h
  66. 33
      upb/structdefs.int.h
  67. 6
      upb/symtab.c
  68. 23
      upb/symtab.h
  69. 11
      upb/table.c
  70. 37
      upb/table.int.h
  71. 6
      upb/upb.c
  72. 15
      upb/upb.h

@ -0,0 +1,7 @@
## <a name="cla"></a> Signing the CLA
Please sign the [Google Contributor License Agreement
(CLA)](https://cla.developers.google.com/)
before sending pull requests. For any code changes to be
accepted, the CLA must be signed. It's a quick process, I
promise!

@ -1,7 +1,4 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
*
* A test that verifies that our results are identical to proto2 for a
* given proto type and input protobuf.

@ -1,7 +1,4 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
*
* A set of tests for JSON parsing and serialization.
*/

@ -1,7 +1,4 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
*
* An exhaustive set of tests for parsing both valid and invalid protobuf
* input, with buffer breaks in arbitrary places.

@ -1,8 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
*/
#include <stdio.h>
#include "upb/pb/varint.int.h"

@ -1,8 +1,4 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Tests for C++ wrappers.
*/

@ -1,11 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
*
* Test of defs and symtab. There should be far more tests of edge conditions
* (like attempts to link defs that don't have required properties set).
*/
** Test of defs and symtab. There should be far more tests of edge conditions
** (like attempts to link defs that don't have required properties set).
*/
#include "upb/def.h"
#include "upb/pb/glue.h"

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
*
*/
#include "upb/handlers.h"
#include "upb/descriptor/descriptor.upb.h"

@ -1,7 +1,4 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
*
* Tests for upb_table.
*/

@ -1,10 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
*
* Common functionality for tests.
*/
** Common functionality for tests.
**/
#ifndef UPB_TEST_UTIL_H_
#define UPB_TEST_UTIL_H_

@ -1,5 +1,3 @@
// Copyright 2012 Google Inc. All Rights Reserved.
// Author: haberman@google.com (Josh Haberman)
#include <stdlib.h>
#ifdef USE_GOOGLE

@ -1,8 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
*/
#ifndef UPB_TEST_H_
#define UPB_TEST_H_

@ -1,9 +1,4 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
//
// IMPORTANT NOTE! Inside Google, This file is compiled TWICE, once with
// UPB_GOOGLE3 defined and once without! This allows us to provide
// functionality against proto2 and protobuf opensource both in a single binary

@ -1,8 +1,7 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
// upb::googlepb::DefBuilder
// upb::googlepb::WriteHandlers
// upb::googlepb::CodeCache
//
// This file contains functionality for constructing upb Defs and Handlers
// corresponding to proto2 messages. Using this functionality, you can use upb

@ -1,9 +1,4 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
//
// This set of handlers can write into a proto2::Message whose reflection class
// is _pi::Proto2Reflection (ie. proto1 messages; while slightly confusing, the
// name "Proto2Reflection" indicates that it is a reflection class implementing

@ -1,9 +1,3 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
//
// Support for registering field handlers that can write into a legacy proto1
// message. This functionality is only needed inside Google.
//

@ -1,9 +1,4 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
//
// Note that we have received an exception from c-style-artiters regarding
// dynamic_cast<> in this file:
// https://groups.google.com/a/google.com/d/msg/c-style/7Zp_XCX0e7s/I6dpzno4l-MJ

@ -1,9 +1,3 @@
//
// upb - a minimalist implementation of protocol buffers.
//
// Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
// Author: Josh Haberman <jhaberman@gmail.com>
//
// Support for registering field handlers that can write into a proto2
// message that uses GeneratedMessageReflection (which includes all messages
// generated by the proto2 compiler as well as DynamicMessage).

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include <linux/kernel.h>

@ -1,8 +1,2 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include <linux/errno.h>

@ -1,8 +1,2 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include <linux/types.h>

@ -1,10 +1,2 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Linux-kernel implementations of some stdlib.h functions.
*/
#include <linux/kernel.h> // For sprintf and friends.

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Linux-kernel implementations of some stdlib.h functions.
*/
** Linux-kernel implementations of some stdlib.h functions.
*/
#include <linux/slab.h>

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#ifndef UPB_LINUX_STRING_H_
#define UPB_LINUX_STRING_H_

@ -1,27 +1,24 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A Lua extension for upb. Exposes only the core library
* (sub-libraries are exposed in other extensions).
*
* 64-bit woes: Lua can only represent numbers of type lua_Number (which is
* double unless the user specifically overrides this). Doubles can represent
* the entire range of 64-bit integers, but lose precision once the integers are
* greater than 2^53.
*
* Lua 5.3 is adding support for integers, which will allow for 64-bit
* integers (which can be interpreted as signed or unsigned).
*
* LuaJIT supports 64-bit signed and unsigned boxed representations
* through its "cdata" mechanism, but this is not portable to regular Lua.
*
* Hopefully Lua 5.3 will come soon enough that we can either use Lua 5.3
* integer support or LuaJIT 64-bit cdata for users that need the entire
* domain of [u]int64 values.
*/
** require("lua") -- A Lua extension for upb.
**
** Exposes only the core library
** (sub-libraries are exposed in other extensions).
**
** 64-bit woes: Lua can only represent numbers of type lua_Number (which is
** double unless the user specifically overrides this). Doubles can represent
** the entire range of 64-bit integers, but lose precision once the integers are
** greater than 2^53.
**
** Lua 5.3 is adding support for integers, which will allow for 64-bit
** integers (which can be interpreted as signed or unsigned).
**
** LuaJIT supports 64-bit signed and unsigned boxed representations
** through its "cdata" mechanism, but this is not portable to regular Lua.
**
** Hopefully Lua 5.3 will come soon enough that we can either use Lua 5.3
** integer support or LuaJIT 64-bit cdata for users that need the entire
** domain of [u]int64 values.
*/
#include <float.h>
#include <math.h>

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Shared definitions for upb Lua modules.
*/
** Shared definitions for upb Lua modules.
*/
#ifndef UPB_LUA_UPB_H_
#define UPB_LUA_UPB_H_

@ -1,14 +1,9 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A Lua extension for upb.pb.
*
* Exposes all the types defined in upb/pb/{*}.h
* Also defines a few convenience functions on top.
*/
** require("upb.pb") -- A Lua extension for upb.pb.
**
** Exposes all the types defined in upb/pb/{*}.h
** Also defines a few convenience functions on top.
*/
#include "upb/bindings/lua/upb.h"
#include "upb/pb/decoder.h"

@ -1,21 +1,17 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Lua extension that provides access to upb_table. This is an internal-only
* interface and exists for the sole purpose of writing a C code generator in
* Lua that can dump a upb_table as static C initializers. This lets us use
* Lua for convenient string manipulation while saving us from re-implementing
* the upb_table hash function and hash table layout / collision strategy in
* Lua.
*
* Since this is used only as part of the toolchain (and not part of the
* runtime) we do not hold this module to the same stringent requirements as
* the main Lua modules (for example that misbehaving Lua programs cannot
* crash the interpreter).
*/
** require("upb.table") -- a Lua extension for accessing upb_table
**
** This is an internal-only interface and exists for the sole purpose of
** writing a C code generator in Lua that can dump a upb_table as static C
** initializers. This lets us use Lua for convenient string manipulation while
** saving us from re-implementing the upb_table hash function and hash table
** layout / collision strategy in Lua.
**
** Since this is used only as part of the toolchain (and not part of the
** runtime) we do not hold this module to the same stringent requirements as
** the main Lua modules (for example that misbehaving Lua programs cannot
** crash the interpreter).
*/
#include <float.h>
#include <math.h>

@ -1,12 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Python extension exposing the core of upb: definitions, handlers,
* and a message type.
*/
** Python extension exposing the core of upb: definitions, handlers,
** and a message type.
**/
#include <stddef.h>
#include <Python.h>

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb (prototype) extension for Ruby.
*/
** upb (prototype) extension for Ruby.
*/
#include "ruby/ruby.h"
#include "ruby/vm.h"

@ -1,7 +1,3 @@
// Copyright 2014 Google Inc. All Rights Reserved.
// Author: haberman@google.com (Josh Haberman)
//
// upb - a minimalist implementation of protocol buffers.
#ifndef UPB_STDCPP_H_
#define UPB_STDCPP_H_

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Handling of errno.
*/
** Handling of errno.
*/
#include "upb/stdc/error.h"

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Handling of errno.
*/
** Handling of errno.
*/
#include "upb/upb.h"

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/stdc/io.h"

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* ANSI C file I/O.
*/
** ANSI C file I/O.
*/
#ifndef UPB_STDC_IO_H_
#define UPB_STDC_IO_H_

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2008-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/def.h"

@ -1,23 +1,21 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Defs are upb's internal representation of the constructs that can appear
* in a .proto file:
*
* - upb_msgdef: describes a "message" construct.
* - upb_fielddef: describes a message field.
* - upb_enumdef: describes an enum.
* (TODO: definitions of services).
*
* Like upb_refcounted objects, defs are mutable only until frozen, and are
* only thread-safe once frozen.
*
* This is a mixed C/C++ interface that offers a full API to both languages.
* See the top-level README for more information.
*/
** Defs are upb's internal representation of the constructs that can appear
** in a .proto file:
**
** - upb::MessageDef (upb_msgdef): describes a "message" construct.
** - upb::FieldDef (upb_fielddef): describes a message field.
** - upb::EnumDef (upb_enumdef): describes an enum.
** - upb::OneofDef (upb_oneofdef): describes a oneof.
** - upb::Def (upb_def): base class of all the others.
**
** TODO: definitions of services.
**
** Like upb_refcounted objects, defs are mutable only until frozen, and are
** only thread-safe once frozen.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
** See the top-level README for more information.
*/
#ifndef UPB_DEF_H_
#define UPB_DEF_H_

@ -1,15 +1,10 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2008-2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* XXX: The routines in this file that consume a string do not currently
* support having the string span buffers. In the future, as upb_sink and
* its buffering/sharing functionality evolve there should be an easy and
* idiomatic way of correctly handling this case. For now, we accept this
* limitation since we currently only parse descriptors from single strings.
*/
** XXX: The routines in this file that consume a string do not currently
** support having the string span buffers. In the future, as upb_sink and
** its buffering/sharing functionality evolve there should be an easy and
** idiomatic way of correctly handling this case. For now, we accept this
** limitation since we currently only parse descriptors from single strings.
*/
#include "upb/descriptor/reader.h"

@ -1,12 +1,8 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb::descriptor::Reader provides a way of building upb::Defs from
* data in descriptor.proto format.
*/
** upb::descriptor::Reader (upb_descreader)
**
** Provides a way of building upb::Defs from data in descriptor.proto format.
*/
#ifndef UPB_DESCRIPTOR_H
#define UPB_DESCRIPTOR_H

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/env.h"

@ -1,19 +1,16 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A upb::Environment provides a means for injecting malloc and an
* error-reporting callback into encoders/decoders. This allows them to be
* independent of nearly all assumptions about their actual environment.
*
* It is also a container for allocating the encoders/decoders themselves that
* insulates clients from knowing their actual size. This provides ABI
* compatibility even if the size of the objects change. And this allows the
* structure definitions to be in the .c files instead of the .h files, making
* the .h files smaller and more readable.
*/
** upb::Environment (upb_env)
**
** A upb::Environment provides a means for injecting malloc and an
** error-reporting callback into encoders/decoders. This allows them to be
** independent of nearly all assumptions about their actual environment.
**
** It is also a container for allocating the encoders/decoders themselves that
** insulates clients from knowing their actual size. This provides ABI
** compatibility even if the size of the objects change. And this allows the
** structure definitions to be in the .c files instead of the .h files, making
** the .h files smaller and more readable.
*/
#include "upb/upb.h"

@ -1,12 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Inline definitions for handlers.h, which are particularly long and a bit
* tricky.
*/
** Inline definitions for handlers.h, which are particularly long and a bit
** tricky.
*/
#ifndef UPB_HANDLERS_INL_H_
#define UPB_HANDLERS_INL_H_

@ -1,12 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* TODO(haberman): it's unclear whether a lot of the consistency checks should
* assert() or return false.
*/
** TODO(haberman): it's unclear whether a lot of the consistency checks should
** assert() or return false.
*/
#include "upb/handlers.h"
#include "upb/structdefs.int.h"

@ -1,23 +1,20 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2010-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
* message can have associated functions that will be called when we are
* parsing or visiting a stream of data. This is similar to how handlers work
* in SAX (the Simple API for XML).
*
* The handlers have no idea where the data is coming from, so a single set of
* handlers could be used with two completely different data sources (for
* example, a parser and a visitor over in-memory objects). This decoupling is
* the most important feature of upb, because it allows parsers and serializers
* to be highly reusable.
*
* This is a mixed C/C++ interface that offers a full API to both languages.
* See the top-level README for more information.
*/
** upb::Handlers (upb_handlers)
**
** A upb_handlers is like a virtual table for a upb_msgdef. Each field of the
** message can have associated functions that will be called when we are
** parsing or visiting a stream of data. This is similar to how handlers work
** in SAX (the Simple API for XML).
**
** The handlers have no idea where the data is coming from, so a single set of
** handlers could be used with two completely different data sources (for
** example, a parser and a visitor over in-memory objects). This decoupling is
** the most important feature of upb, because it allows parsers and serializers
** to be highly reusable.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
** See the top-level README for more information.
*/
#ifndef UPB_HANDLERS_H
#define UPB_HANDLERS_H

@ -1,12 +1,9 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb::json::Parser can parse JSON according to a specific schema.
* Support for parsing arbitrary JSON (schema-less) will be added later.
*/
** upb::json::Parser (upb_json_parser)
**
** Parses JSON according to a specific schema.
** Support for parsing arbitrary JSON (schema-less) will be added later.
*/
#ifndef UPB_JSON_PARSER_H_
#define UPB_JSON_PARSER_H_

@ -1,12 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* This currently uses snprintf() to format primitives, and could be optimized
* further.
*/
** This currently uses snprintf() to format primitives, and could be optimized
** further.
*/
#include "upb/json/printer.h"

@ -1,12 +1,8 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb::json::Printer allows you to create handlers that emit JSON
* according to a specific protobuf schema.
*/
** upb::json::Printer
**
** Handlers that emit JSON according to a specific protobuf schema.
*/
#ifndef UPB_JSON_TYPED_PRINTER_H_
#define UPB_JSON_TYPED_PRINTER_H_

@ -1,19 +1,16 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2013 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Code to compile a upb::Handlers into bytecode for decoding a protobuf
* according to that specific schema and destination handlers.
*
* Compiling to bytecode is always the first step. If we are using the
* interpreted decoder we leave it as bytecode and interpret that. If we are
* using a JIT decoder we use a code generator to turn the bytecode into native
* code, LLVM IR, etc.
*
* Bytecode definition is in decoder.int.h.
*/
** protobuf decoder bytecode compiler
**
** Code to compile a upb::Handlers into bytecode for decoding a protobuf
** according to that specific schema and destination handlers.
**
** Compiling to bytecode is always the first step. If we are using the
** interpreted decoder we leave it as bytecode and interpret that. If we are
** using a JIT decoder we use a code generator to turn the bytecode into native
** code, LLVM IR, etc.
**
** Bytecode definition is in decoder.int.h.
*/
#include <stdarg.h>
#include "upb/pb/decoder.int.h"

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2013 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Driver code for the x64 JIT compiler.
*/
** Driver code for the x64 JIT compiler.
*/
/* Needed to ensure we get defines like MAP_ANON. */
#define _GNU_SOURCE

@ -1,22 +1,17 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2008-2013 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* This file implements a VM for the interpreted (bytecode) decoder.
*
* Bytecode must previously have been generated using the bytecode compiler in
* compile_decoder.c. This decoder then walks through the bytecode op-by-op to
* parse the input.
*
* Decoding is fully resumable; we just keep a pointer to the current bytecode
* instruction and resume from there. A fair amount of the logic here is to
* handle the fact that values can span buffer seams and we have to be able to
* be capable of suspending/resuming from any byte in the stream. This
* sometimes requires keeping a few trailing bytes from the last buffer around
* in the "residual" buffer.
*/
** upb::Decoder (Bytecode Decoder VM)
**
** Bytecode must previously have been generated using the bytecode compiler in
** compile_decoder.c. This decoder then walks through the bytecode op-by-op to
** parse the input.
**
** Decoding is fully resumable; we just keep a pointer to the current bytecode
** instruction and resume from there. A fair amount of the logic here is to
** handle the fact that values can span buffer seams and we have to be able to
** be capable of suspending/resuming from any byte in the stream. This
** sometimes requires keeping a few trailing bytes from the last buffer around
** in the "residual" buffer.
*/
#include <inttypes.h>
#include <stddef.h>

@ -1,19 +1,16 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb::pb::Decoder implements a high performance, streaming, resumable decoder
* for the binary protobuf format.
*
* This interface works the same regardless of what decoder backend is being
* used. A client of this class does not need to know whether decoding is using
* a JITted decoder (DynASM, LLVM, etc) or an interpreted decoder. By default,
* it will always use the fastest available decoder. However, you can call
* set_allow_jit(false) to disable any JIT decoder that might be available.
* This is primarily useful for testing purposes.
*/
** upb::pb::Decoder
**
** A high performance, streaming, resumable decoder for the binary protobuf
** format.
**
** This interface works the same regardless of what decoder backend is being
** used. A client of this class does not need to know whether decoding is using
** a JITted decoder (DynASM, LLVM, etc) or an interpreted decoder. By default,
** it will always use the fastest available decoder. However, you can call
** set_allow_jit(false) to disable any JIT decoder that might be available.
** This is primarily useful for testing purposes.
*/
#ifndef UPB_DECODER_H_
#define UPB_DECODER_H_

@ -1,11 +1,6 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Internal-only definitions for the decoder.
*/
** Internal-only definitions for the decoder.
*/
#ifndef UPB_DECODER_INT_H_
#define UPB_DECODER_INT_H_

@ -1,61 +1,58 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2014 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Since we are implementing pure handlers (ie. without any out-of-band access
* to pre-computed lengths), we have to buffer all submessages before we can
* emit even their first byte.
*
* Not knowing the size of submessages also means we can't write a perfect
* zero-copy implementation, even with buffering. Lengths are stored as
* varints, which means that we don't know how many bytes to reserve for the
* length until we know what the length is.
*
* This leaves us with three main choices:
*
* 1. buffer all submessage data in a temporary buffer, then copy it exactly
* once into the output buffer.
*
* 2. attempt to buffer data directly into the output buffer, estimating how
* many bytes each length will take. When our guesses are wrong, use
* memmove() to grow or shrink the allotted space.
*
* 3. buffer directly into the output buffer, allocating a max length
* ahead-of-time for each submessage length. If we overallocated, we waste
* space, but no memcpy() or memmove() is required. This approach requires
* defining a maximum size for submessages and rejecting submessages that
* exceed that size.
*
* (2) and (3) have the potential to have better performance, but they are more
* complicated and subtle to implement:
*
* (3) requires making an arbitrary choice of the maximum message size; it
* wastes space when submessages are shorter than this and fails
* completely when they are longer. This makes it more finicky and
* requires configuration based on the input. It also makes it impossible
* to perfectly match the output of reference encoders that always use the
* optimal amount of space for each length.
*
* (2) requires guessing the the size upfront, and if multiple lengths are
* guessed wrong the minimum required number of memmove() operations may
* be complicated to compute correctly. Implemented properly, it may have
* a useful amortized or average cost, but more investigation is required
* to determine this and what the optimal algorithm is to achieve it.
*
* (1) makes you always pay for exactly one copy, but its implementation is
* the simplest and its performance is predictable.
*
* So for now, we implement (1) only. If we wish to optimize later, we should
* be able to do it without affecting users.
*
* The strategy is to buffer the segments of data that do *not* depend on
* unknown lengths in one buffer, and keep a separate buffer of segment pointers
* and lengths. When the top-level submessage ends, we can go beginning to end,
* alternating the writing of lengths with memcpy() of the rest of the data.
* At the top level though, no buffering is required.
*/
** upb::Encoder
**
** Since we are implementing pure handlers (ie. without any out-of-band access
** to pre-computed lengths), we have to buffer all submessages before we can
** emit even their first byte.
**
** Not knowing the size of submessages also means we can't write a perfect
** zero-copy implementation, even with buffering. Lengths are stored as
** varints, which means that we don't know how many bytes to reserve for the
** length until we know what the length is.
**
** This leaves us with three main choices:
**
** 1. buffer all submessage data in a temporary buffer, then copy it exactly
** once into the output buffer.
**
** 2. attempt to buffer data directly into the output buffer, estimating how
** many bytes each length will take. When our guesses are wrong, use
** memmove() to grow or shrink the allotted space.
**
** 3. buffer directly into the output buffer, allocating a max length
** ahead-of-time for each submessage length. If we overallocated, we waste
** space, but no memcpy() or memmove() is required. This approach requires
** defining a maximum size for submessages and rejecting submessages that
** exceed that size.
**
** (2) and (3) have the potential to have better performance, but they are more
** complicated and subtle to implement:
**
** (3) requires making an arbitrary choice of the maximum message size; it
** wastes space when submessages are shorter than this and fails
** completely when they are longer. This makes it more finicky and
** requires configuration based on the input. It also makes it impossible
** to perfectly match the output of reference encoders that always use the
** optimal amount of space for each length.
**
** (2) requires guessing the the size upfront, and if multiple lengths are
** guessed wrong the minimum required number of memmove() operations may
** be complicated to compute correctly. Implemented properly, it may have
** a useful amortized or average cost, but more investigation is required
** to determine this and what the optimal algorithm is to achieve it.
**
** (1) makes you always pay for exactly one copy, but its implementation is
** the simplest and its performance is predictable.
**
** So for now, we implement (1) only. If we wish to optimize later, we should
** be able to do it without affecting users.
**
** The strategy is to buffer the segments of data that do *not* depend on
** unknown lengths in one buffer, and keep a separate buffer of segment pointers
** and lengths. When the top-level submessage ends, we can go beginning to end,
** alternating the writing of lengths with memcpy() of the rest of the data.
** At the top level though, no buffering is required.
*/
#include "upb/pb/encoder.h"
#include "upb/pb/varint.int.h"

@ -1,16 +1,13 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2010 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Implements a set of upb_handlers that write protobuf data to the binary wire
* format.
*
* This encoder implementation does not have any access to any out-of-band or
* precomputed lengths for submessages, so it must buffer submessages internally
* before it can emit the first byte.
*/
** upb::pb::Encoder (upb_pb_encoder)
**
** Implements a set of upb_handlers that write protobuf data to the binary wire
** format.
**
** This encoder implementation does not have any access to any out-of-band or
** precomputed lengths for submessages, so it must buffer submessages internally
** before it can emit the first byte.
*/
#ifndef UPB_ENCODER_H_
#define UPB_ENCODER_H_

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2010-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/pb/glue.h"

@ -1,27 +1,22 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* upb's core components like upb_decoder and upb_msg are carefully designed to
* avoid depending on each other for maximum orthogonality. In other words,
* you can use a upb_decoder to decode into *any* kind of structure; upb_msg is
* just one such structure. A upb_msg can be serialized/deserialized into any
* format, protobuf binary format is just one such format.
*
* However, for convenience we provide functions here for doing common
* operations like deserializing protobuf binary format into a upb_msg. The
* compromise is that this file drags in almost all of upb as a dependency,
* which could be undesirable if you're trying to use a trimmed-down build of
* upb.
*
* While these routines are convenient, they do not reuse any encoding/decoding
* state. For example, if a decoder is JIT-based, it will be re-JITted every
* time these functions are called. For this reason, if you are parsing lots
* of data and efficiency is an issue, these may not be the best functions to
* use (though they are useful for prototyping, before optimizing).
*/
** upb's core components like upb_decoder and upb_msg are carefully designed to
** avoid depending on each other for maximum orthogonality. In other words,
** you can use a upb_decoder to decode into *any* kind of structure; upb_msg is
** just one such structure. A upb_msg can be serialized/deserialized into any
** format, protobuf binary format is just one such format.
**
** However, for convenience we provide functions here for doing common
** operations like deserializing protobuf binary format into a upb_msg. The
** compromise is that this file drags in almost all of upb as a dependency,
** which could be undesirable if you're trying to use a trimmed-down build of
** upb.
**
** While these routines are convenient, they do not reuse any encoding/decoding
** state. For example, if a decoder is JIT-based, it will be re-JITted every
** time these functions are called. For this reason, if you are parsing lots
** of data and efficiency is an issue, these may not be the best functions to
** use (though they are useful for prototyping, before optimizing).
*/
#ifndef UPB_GLUE_H
#define UPB_GLUE_H

@ -1,8 +1,5 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
* upb::pb::TextPrinter
*
* OPT: This is not optimized at all. It uses printf() which parses the format
* string every time, and it allocates memory for every put.

@ -1,9 +1,8 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
** upb::pb::TextPrinter (upb_textprinter)
**
** Handlers for writing to protobuf text format.
*/
#ifndef UPB_TEXT_H_
#define UPB_TEXT_H_

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/pb/varint.int.h"

@ -1,12 +1,7 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2011 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A number of routines for varint manipulation (we keep them all around to
* have multiple approaches available for benchmarking).
*/
** A number of routines for varint manipulation (we keep them all around to
** have multiple approaches available for benchmarking).
*/
#ifndef UPB_VARINT_DECODER_H_
#define UPB_VARINT_DECODER_H_

@ -1,22 +1,19 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Our key invariants are:
* 1. reference cycles never span groups
* 2. for ref2(to, from), we increment to's count iff group(from) != group(to)
*
* The previous two are how we avoid leaking cycles. Other important
* invariants are:
* 3. for mutable objects "from" and "to", if there exists a ref2(to, from)
* this implies group(from) == group(to). (In practice, what we implement
* is even stronger; "from" and "to" will share a group if there has *ever*
* been a ref2(to, from), but all that is necessary for correctness is the
* weaker one).
* 4. mutable and immutable objects are never in the same group.
*/
** upb::RefCounted Implementation
**
** Our key invariants are:
** 1. reference cycles never span groups
** 2. for ref2(to, from), we increment to's count iff group(from) != group(to)
**
** The previous two are how we avoid leaking cycles. Other important
** invariants are:
** 3. for mutable objects "from" and "to", if there exists a ref2(to, from)
** this implies group(from) == group(to). (In practice, what we implement
** is even stronger; "from" and "to" will share a group if there has *ever*
** been a ref2(to, from), but all that is necessary for correctness is the
** weaker one).
** 4. mutable and immutable objects are never in the same group.
*/
#include "upb/refcounted.h"

@ -1,20 +1,17 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A refcounting scheme that supports circular refs. It accomplishes this by
* partitioning the set of objects into groups such that no cycle spans groups;
* we can then reference-count the group as a whole and ignore refs within the
* group. When objects are mutable, these groups are computed very
* conservatively; we group any objects that have ever had a link between them.
* When objects are frozen, we compute strongly-connected components which
* allows us to be precise and only group objects that are actually cyclic.
*
* This is a mixed C/C++ interface that offers a full API to both languages.
* See the top-level README for more information.
*/
** upb::RefCounted (upb_refcounted)
**
** A refcounting scheme that supports circular refs. It accomplishes this by
** partitioning the set of objects into groups such that no cycle spans groups;
** we can then reference-count the group as a whole and ignore refs within the
** group. When objects are mutable, these groups are computed very
** conservatively; we group any objects that have ever had a link between them.
** When objects are frozen, we compute strongly-connected components which
** allows us to be precise and only group objects that are actually cyclic.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
** See the top-level README for more information.
*/
#ifndef UPB_REFCOUNTED_H_
#define UPB_REFCOUNTED_H_

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2013 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/shim/shim.h"

@ -1,19 +1,14 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2013 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* For handlers that do very tiny, very simple operations, the function call
* overhead of calling a handler can be significant. This file allows the
* user to define handlers that do something very simple like store the value
* to memory and/or set a hasbit. JIT compilers can then special-case these
* handlers and emit specialized code for them instead of actually calling the
* handler.
*
* The functionality is very simple/limited right now but may expand to be able
* to call another function.
*/
** For handlers that do very tiny, very simple operations, the function call
** overhead of calling a handler can be significant. This file allows the
** user to define handlers that do something very simple like store the value
** to memory and/or set a hasbit. JIT compilers can then special-case these
** handlers and emit specialized code for them instead of actually calling the
** handler.
**
** The functionality is very simple/limited right now but may expand to be able
** to call another function.
*/
#ifndef UPB_SHIM_H
#define UPB_SHIM_H

@ -1,21 +1,19 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2010-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A upb_sink is an object that binds a upb_handlers object to some runtime
* state. It is the object that can actually receive data via the upb_handlers
* interface.
*
* Unlike upb_def and upb_handlers, upb_sink is never frozen, immutable, or
* thread-safe. You can create as many of them as you want, but each one may
* only be used in a single thread at a time.
*
* If we compare with class-based OOP, a you can think of a upb_def as an
* abstract base class, a upb_handlers as a concrete derived class, and a
* upb_sink as an object (class instance).
*/
** upb::Sink (upb_sink)
** upb::BytesSink (upb_bytessink)
**
** A upb_sink is an object that binds a upb_handlers object to some runtime
** state. It is the object that can actually receive data via the upb_handlers
** interface.
**
** Unlike upb_def and upb_handlers, upb_sink is never frozen, immutable, or
** thread-safe. You can create as many of them as you want, but each one may
** only be used in a single thread at a time.
**
** If we compare with class-based OOP, a you can think of a upb_def as an
** abstract base class, a upb_handlers as a concrete derived class, and a
** upb_sink as an object (class instance).
*/
#ifndef UPB_SINK_H
#define UPB_SINK_H

@ -1,23 +1,18 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2015 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* This file contains definitions of structs that should be considered private
* and NOT stable across versions of upb.
*
* The only reason they are declared here and not in .c files is to allow upb
* and the application (if desired) to embed statically-initialized instances
* of structures like defs.
*
* If you include this file, all guarantees of ABI compatibility go out the
* window! Any code that includes this file needs to recompile against the
* exact same version of upb that they are linking against.
*
* You also need to recompile if you change the value of the UPB_DEBUG_REFS
* flag.
*/
** This file contains definitions of structs that should be considered private
** and NOT stable across versions of upb.
**
** The only reason they are declared here and not in .c files is to allow upb
** and the application (if desired) to embed statically-initialized instances
** of structures like defs.
**
** If you include this file, all guarantees of ABI compatibility go out the
** window! Any code that includes this file needs to recompile against the
** exact same version of upb that they are linking against.
**
** You also need to recompile if you change the value of the UPB_DEBUG_REFS
** flag.
*/
#include "upb/def.h"

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2008-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include "upb/structdefs.int.h"
#include "upb/symtab.h"

@ -1,17 +1,14 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* A symtab (symbol table) stores a name->def map of upb_defs. Clients could
* always create such tables themselves, but upb_symtab has logic for resolving
* symbolic references, and in particular, for keeping a whole set of consistent
* defs when replacing some subset of those defs. This logic is nontrivial.
*
* This is a mixed C/C++ interface that offers a full API to both languages.
* See the top-level README for more information.
*/
** upb::SymbolTable (upb_symtab)
**
** A symtab (symbol table) stores a name->def map of upb_defs. Clients could
** always create such tables themselves, but upb_symtab has logic for resolving
** symbolic references, and in particular, for keeping a whole set of consistent
** defs when replacing some subset of those defs. This logic is nontrivial.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
** See the top-level README for more information.
*/
#ifndef UPB_SYMTAB_H_
#define UPB_SYMTAB_H_

@ -1,11 +1,8 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* Implementation is heavily inspired by Lua's ltable.c.
*/
** upb_table Implementation
**
** Implementation is heavily inspired by Lua's ltable.c.
*/
#include "upb/table.int.h"

@ -1,24 +1,21 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* This header is INTERNAL-ONLY! Its interfaces are not public or stable!
* This file defines very fast int->upb_value (inttable) and string->upb_value
* (strtable) hash tables.
*
* The table uses chained scatter with Brent's variation (inspired by the Lua
* implementation of hash tables). The hash function for strings is Austin
* Appleby's "MurmurHash."
*
* The inttable uses uintptr_t as its key, which guarantees it can be used to
* store pointers or integers of at least 32 bits (upb isn't really useful on
* systems where sizeof(void*) < 4).
*
* The table must be homogenous (all values of the same type). In debug
* mode, we check this on insert and lookup.
*/
** upb_table
**
** This header is INTERNAL-ONLY! Its interfaces are not public or stable!
** This file defines very fast int->upb_value (inttable) and string->upb_value
** (strtable) hash tables.
**
** The table uses chained scatter with Brent's variation (inspired by the Lua
** implementation of hash tables). The hash function for strings is Austin
** Appleby's "MurmurHash."
**
** The inttable uses uintptr_t as its key, which guarantees it can be used to
** store pointers or integers of at least 32 bits (upb isn't really useful on
** systems where sizeof(void*) < 4).
**
** The table must be homogenous (all values of the same type). In debug
** mode, we check this on insert and lookup.
*/
#ifndef UPB_TABLE_H_
#define UPB_TABLE_H_

@ -1,9 +1,3 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009-2012 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*/
#include <errno.h>
#include <stdarg.h>

@ -1,14 +1,9 @@
/*
* upb - a minimalist implementation of protocol buffers.
*
* Copyright (c) 2009 Google Inc. See LICENSE for details.
* Author: Josh Haberman <jhaberman@gmail.com>
*
* This file contains shared definitions that are widely used across upb.
*
* This is a mixed C/C++ interface that offers a full API to both languages.
* See the top-level README for more information.
*/
** This file contains shared definitions that are widely used across upb.
**
** This is a mixed C/C++ interface that offers a full API to both languages.
** See the top-level README for more information.
*/
#ifndef UPB_H_
#define UPB_H_

Loading…
Cancel
Save