File: test_binary.c

package info (click to toggle)
upb 0.0.0~git200730-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,696 kB
  • sloc: ansic: 16,828; cpp: 5,098; python: 360; pascal: 160; ruby: 21; sh: 19; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 375 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#include <time.h>

#include "foo.upb.h"

int main() {
  upb_arena *arena = upb_arena_new();
  Foo* foo = Foo_new(arena);
  const char greeting[] = "Hello, World!\n";

  Foo_set_time(foo, time(NULL));
  /* Warning: the proto will not copy this, the string data must outlive
   * the proto. */
  Foo_set_greeting(foo, upb_strview_makez(greeting));

  upb_arena_free(arena);
}