OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/public/go/system/c_allocators.h" | 5 #include "mojo/public/go/system/c_allocators.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include "mojo/public/c/system/core.h" | 8 #include "mojo/public/c/system/core.h" |
9 | 9 |
10 struct WaitParams MallocWaitParams() { | 10 struct WaitParams MallocWaitParams() { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 struct WriteDataParams p; | 150 struct WriteDataParams p; |
151 p.num_bytes = (uint32_t*)malloc(sizeof(uint32_t)); | 151 p.num_bytes = (uint32_t*)malloc(sizeof(uint32_t)); |
152 p.elements = (void*)malloc(length * sizeof(void)); | 152 p.elements = (void*)malloc(length * sizeof(void)); |
153 return p; | 153 return p; |
154 } | 154 } |
155 | 155 |
156 void FreeWriteDataParams(struct WriteDataParams p) { | 156 void FreeWriteDataParams(struct WriteDataParams p) { |
157 free(p.num_bytes); | 157 free(p.num_bytes); |
158 free(p.elements); | 158 free(p.elements); |
159 } | 159 } |
| 160 |
| 161 struct TwoPhaseActionParams MallocTwoPhaseActionParams() { |
| 162 struct TwoPhaseActionParams p; |
| 163 p.buffer = (void**)malloc(sizeof(void*)); |
| 164 p.num_bytes = (uint32_t*)malloc(sizeof(uint32_t)); |
| 165 return p; |
| 166 } |
| 167 |
| 168 void FreeTwoPhaseActionParams(struct TwoPhaseActionParams p) { |
| 169 free(p.buffer); |
| 170 free(p.num_bytes); |
| 171 } |
OLD | NEW |