summaryrefslogtreecommitdiff
path: root/src/upb.c
blob: bd41613ab2fc7e90e4c9d3fd30a630082343bfb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * upb - a minimalist implementation of protocol buffers.
 *
 * Copyright (c) 2009 Joshua Haberman.  See LICENSE for details.
 *
 */

#include <stdarg.h>
#include <stddef.h>
#include <string.h>

#include "upb.h"

void upb_seterr(upb_status *status, enum upb_status_code code,
                const char *msg, ...)
{
  if(upb_ok(status)) {  // The first error is the most interesting.
    status->code = code;
    va_list args;
    va_start(args, msg);
    vsnprintf(status->msg, UPB_ERRORMSG_MAXLEN, msg, args);
    va_end(args);
  }
}

void upb_copyerr(upb_status *to, upb_status *from)
{
  to->code = from->code;
  strcpy(to->msg, from->msg);
}

generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback