* Written by Eric Blake and Bruno Haible
*
* This program is free software: you can redistribute it and/or modify
* Written by Eric Blake and Bruno Haible
*
* This program is free software: you can redistribute it and/or modify
/* Calculating void * + int is not portable, so this wrapper converts
to char * to make the tests easier to write. */
#define MEMRCHR (char *) memrchr
int
/* Calculating void * + int is not portable, so this wrapper converts
to char * to make the tests easier to write. */
#define MEMRCHR (char *) memrchr
int
ASSERT (MEMRCHR (input, 'a', n) == input + n - 1);
ASSERT (MEMRCHR (input, 'a', 0) == NULL);
ASSERT (MEMRCHR (input, 'a', n) == input + n - 1);
ASSERT (MEMRCHR (input, 'a', 0) == NULL);
ASSERT (MEMRCHR (input, 'b', n) == input + n - 2);
ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
ASSERT (MEMRCHR (input, 'b', n) == input + n - 2);
ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
- for (j = 0; j < 256; j++)
- input[i + j] = j;
- for (j = 0; j < 256; j++)
- {
- ASSERT (MEMRCHR (input + i, j, 256) == input + i + j);
- }
+ for (j = 0; j < 256; j++)
+ input[i + j] = j;
+ for (j = 0; j < 256; j++)
+ {
+ ASSERT (MEMRCHR (input + i, j, 256) == input + i + j);
+ }