mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Remove superfluous null checks in can_read/access_at_index macros
This commit is contained in:
parent
0715259635
commit
ce5f31ac47
4
cJSON.c
4
cJSON.c
@ -270,9 +270,9 @@ typedef struct
|
||||
} parse_buffer;
|
||||
|
||||
/* check if the given size is left to read in a given parse buffer (starting with 1) */
|
||||
#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
|
||||
#define can_read(buffer, size) (((buffer)->offset + (size)) <= (buffer)->length)
|
||||
/* check if the buffer can be accessed at the given index (starting with 0) */
|
||||
#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
|
||||
#define can_access_at_index(buffer, index) (((buffer)->offset + (index)) < (buffer)->length)
|
||||
#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
|
||||
/* get a pointer to the buffer at the position */
|
||||
#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user