/*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
* Written by Eric Blake and Bruno Haible
*
* This program is free software: you can redistribute it and/or modify
#include <string.h>
-#include <stdio.h>
+#include "signature.h"
+SIGNATURE_CHECK (strchrnul, char *, (char const *, int));
+
#include <stdlib.h>
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
int
-main ()
+main (void)
{
size_t n = 0x100000;
char *input = malloc (n + 1);
size_t repeat = 10000;
for (; repeat > 0; repeat--)
{
- ASSERT (strchrnul (input, 'c') == input + 2);
+ ASSERT (strchrnul (input, 'c') == input + 2);
}
}
int i, j;
for (i = 0; i < 32; i++)
{
- for (j = 0; j < 256; j++)
- input[i + j] = (j + 1) & 0xff;
- for (j = 1; j < 256; j++)
- {
- ASSERT (strchrnul (input + i, j) == input + i + j - 1);
- input[i + j - 1] = (j == 1 ? 2 : 1);
- ASSERT (strchrnul (input + i, j) == input + i + 255);
- input[i + j - 1] = j;
- }
+ for (j = 0; j < 256; j++)
+ input[i + j] = (j + 1) & 0xff;
+ for (j = 1; j < 256; j++)
+ {
+ ASSERT (strchrnul (input + i, j) == input + i + j - 1);
+ input[i + j - 1] = (j == 1 ? 2 : 1);
+ ASSERT (strchrnul (input + i, j) == input + i + 255);
+ input[i + j - 1] = j;
+ }
}
}