ucx/buffer.c

changeset 152
62921b370c60
parent 124
80609f9675f1
child 157
0b33b9396851
equal deleted inserted replaced
151:11f3bb408051 152:62921b370c60
1 /* 1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 * 3 *
4 * Copyright 2015 Olaf Wintermann. All rights reserved. 4 * Copyright 2016 Olaf Wintermann. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
148 } 148 }
149 149
150 size_t ucx_buffer_write(const void *ptr, size_t size, size_t nitems, 150 size_t ucx_buffer_write(const void *ptr, size_t size, size_t nitems,
151 UcxBuffer *buffer) { 151 UcxBuffer *buffer) {
152 size_t len = size * nitems; 152 size_t len = size * nitems;
153 const char *string = ptr;
153 size_t required = buffer->pos + len; 154 size_t required = buffer->pos + len;
154 if (buffer->pos > required) { 155 if (buffer->pos > required) {
155 return 0; 156 return 0;
156 } 157 }
157 158

mercurial