comparison buffer_static.c @ 712:8295148e8f44

buffer: rename internal 'used' member to a more obvious name It really keeps track of the number of readable bytes in the buffer. In other words, it keeps track of the size - hence the new name. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Tue, 19 Mar 2019 14:43:26 -0400
parents 0fa2f6606c5e
children 1c4d7ff0a682
comparison
equal deleted inserted replaced
711:f2cc03ad4b1f 712:8295148e8f44
1 /* 1 /*
2 * Copyright (c) 2017-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> 2 * Copyright (c) 2017-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal 5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights 6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48 } 48 }
49 49
50 static int static_buffer_check_append_rw(struct buffer *buffer, const void *data, 50 static int static_buffer_check_append_rw(struct buffer *buffer, const void *data,
51 size_t size) 51 size_t size)
52 { 52 {
53 if ((buffer->used + size) <= buffer->allocsize) 53 if ((buffer->size + size) <= buffer->allocsize)
54 return 0; 54 return 0;
55 55
56 return -ENOSPC; 56 return -ENOSPC;
57 } 57 }
58 58