diff options
author | 2019-11-28 02:58:39 +0000 | |
---|---|---|
committer | 2019-11-28 02:58:39 +0000 | |
commit | 9e5c2ddccc4a7ac0840ab8aa8ee64df773f69be5 (patch) | |
tree | 87472542e42cefecfb278df616a2df50e52c34b1 /lib/libcbor/src/cbor/internal/stack.c | |
parent | Fix the buffer cache code to not use a giant uvm obj of all pages (diff) | |
download | wireguard-openbsd-9e5c2ddccc4a7ac0840ab8aa8ee64df773f69be5.tar.xz wireguard-openbsd-9e5c2ddccc4a7ac0840ab8aa8ee64df773f69be5.zip |
update to libcbor rev 56a43b1e799; this includes a number of fixes
for unaligned accesses, requested by miod@
ok deraadt@
Diffstat (limited to 'lib/libcbor/src/cbor/internal/stack.c')
-rw-r--r-- | lib/libcbor/src/cbor/internal/stack.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/libcbor/src/cbor/internal/stack.c b/lib/libcbor/src/cbor/internal/stack.c index 65e15fe9379..fc433ef31f0 100644 --- a/lib/libcbor/src/cbor/internal/stack.c +++ b/lib/libcbor/src/cbor/internal/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Pavel Kalvoda <me@pavelkalvoda.com> + * Copyright (c) 2014-2019 Pavel Kalvoda <me@pavelkalvoda.com> * * libcbor is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -7,27 +7,26 @@ #include "stack.h" -struct _cbor_stack _cbor_stack_init() -{ - return (struct _cbor_stack) {.top = NULL, .size = 0}; +struct _cbor_stack _cbor_stack_init() { + return (struct _cbor_stack){.top = NULL, .size = 0}; } -void _cbor_stack_pop(struct _cbor_stack *stack) -{ - struct _cbor_stack_record *top = stack->top; - stack->top = stack->top->lower; - _CBOR_FREE(top); - stack->size--; +void _cbor_stack_pop(struct _cbor_stack *stack) { + struct _cbor_stack_record *top = stack->top; + stack->top = stack->top->lower; + _CBOR_FREE(top); + stack->size--; } -struct _cbor_stack_record *_cbor_stack_push(struct _cbor_stack *stack, cbor_item_t *item, size_t subitems) -{ - struct _cbor_stack_record *new_top = _CBOR_MALLOC(sizeof(struct _cbor_stack_record)); - if (new_top == NULL) - return NULL; +struct _cbor_stack_record *_cbor_stack_push(struct _cbor_stack *stack, + cbor_item_t *item, + size_t subitems) { + struct _cbor_stack_record *new_top = + _CBOR_MALLOC(sizeof(struct _cbor_stack_record)); + if (new_top == NULL) return NULL; - *new_top = (struct _cbor_stack_record) {stack->top, item, subitems}; - stack->top = new_top; - stack->size++; - return new_top; + *new_top = (struct _cbor_stack_record){stack->top, item, subitems}; + stack->top = new_top; + stack->size++; + return new_top; } |