Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: mojo/public/c/bindings/lib/buffer.c

Issue 2232833003: Change the canonical way to include the C bindings headers to <mojo/bindings/*.h>. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_mojo_tests
Patch Set: rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/c/bindings/lib/array.c ('k') | mojo/public/c/bindings/lib/map.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/public/c/bindings/buffer.h"
6
7 #include <assert.h>
8 #include <stddef.h>
9
10 #include "mojo/public/c/bindings/lib/util.h"
11
12 void* MojomBuffer_Allocate(struct MojomBuffer* buf, uint32_t num_bytes) {
13 assert(buf);
14
15 const uint32_t bytes_used = buf->num_bytes_used;
16 const uint64_t size = MOJOM_INTERNAL_ROUND_TO_8((uint64_t)num_bytes);
17 if (bytes_used + size > buf->buf_size)
18 return NULL;
19
20 buf->num_bytes_used += size;
21 return buf->buf + bytes_used;
22 }
OLDNEW
« no previous file with comments | « mojo/public/c/bindings/lib/array.c ('k') | mojo/public/c/bindings/lib/map.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698