Refactored strtok_r compatibility layer to compat/posix.h

This commit is contained in:
Snaipe 2015-10-05 16:22:16 +02:00
parent 237bcb57df
commit 0d3537d891
4 changed files with 37 additions and 49 deletions

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: criterion 2.0.0\n"
"Report-Msgid-Bugs-To: franklinmathieu+criterion@gmail.com\n"
"POT-Creation-Date: 2015-10-01 23:09+0200\n"
"POT-Creation-Date: 2015-10-05 16:20+0200\n"
"PO-Revision-Date: 2015-04-03 17:58+0200\n"
"Last-Translator: <franklinmathieu@gmail.com>\n"
"Language-Team: French\n"
@ -18,70 +18,70 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: src/log/normal.c:50
#: src/log/normal.c:41
#, c-format
msgid "Criterion v%s\n"
msgstr "Criterion v%s\n"
#: src/log/normal.c:51
#: src/log/normal.c:42
#, c-format
msgid " %s\n"
msgstr " %s\n"
#: src/log/normal.c:54 src/log/normal.c:56
#: src/log/normal.c:45 src/log/normal.c:47
#, c-format
msgid "%1$s::%2$s\n"
msgstr "%1$s::%2$s\n"
#: src/log/normal.c:55
#: src/log/normal.c:46
#, fuzzy, c-format
msgid "%1$s::%2$s: (%3$3.2fs)\n"
msgstr "%1$s::%2$s: (%3$3.2fs)\n"
#: src/log/normal.c:57
#: src/log/normal.c:48
#, c-format
msgid "%1$s::%2$s: Test is disabled\n"
msgstr "%1$s::%2$s: Le test est désactivé\n"
#: src/log/normal.c:58
#: src/log/normal.c:49
#, c-format
msgid "%1$s::%2$s: Suite is disabled\n"
msgstr "%1$s::%2$s: La suite est désactivée\n"
#: src/log/normal.c:59
#: src/log/normal.c:50
#, c-format
msgid "%1$s%2$s%3$s:%4$s%5$d%6$s: Assertion failed: %7$s\n"
msgstr "%1$s%2$s%3$s:%4$s%5$d%6$s: Échec d'assertion: %7$s\n"
#: src/log/normal.c:60
#: src/log/normal.c:51
#, fuzzy, c-format
msgid " Theory %1$s::%2$s failed with the following parameters: (%3$s)\n"
msgstr ""
" La théorie %1$s::%2$s a échoué avec les paramètres suivants: (%3$s)\n"
#: src/log/normal.c:61
#: src/log/normal.c:52
#, fuzzy, c-format
msgid "%1$s::%2$s: Timed out. (%3$3.2fs)\n"
msgstr "%1$s::%2$s: Délai expiré. (%3$3.2fs)\n"
#: src/log/normal.c:62
#: src/log/normal.c:53
#, c-format
msgid "%1$s%2$s%3$s:%4$s%5$u%6$s: Unexpected signal caught below this line!\n"
msgstr ""
"%1$s%2$s%3$s:%4$s%5$u%6$s: Un signal inattendu a été reçu après cette "
"ligne!\n"
#: src/log/normal.c:63
#: src/log/normal.c:54
#, c-format
msgid "%1$s::%2$s: CRASH!\n"
msgstr "%1$s::%2$s: PLANTAGE!\n"
#: src/log/normal.c:64
#: src/log/normal.c:55
#, fuzzy, c-format
msgid "%1$s::%2$s: %3$s\n"
msgstr "%1$s::%2$s: (%3$3.2fs)\n"
#: src/log/normal.c:65
#: src/log/normal.c:56
#, fuzzy, c-format
msgid ""
"%1$sWarning! The test `%2$s::%3$s` crashed during its setup or teardown."
@ -90,7 +90,7 @@ msgstr ""
"%1$sAttention! Le test `%2$s::%3$s` a planté pendant son initialisation ou "
"sa finalisation.%4$s\n"
#: src/log/normal.c:66
#: src/log/normal.c:57
#, fuzzy, c-format
msgid ""
"%1$sWarning! The test `%2$s::%3$s` exited during its setup or teardown.%4$s\n"
@ -98,14 +98,14 @@ msgstr ""
"%1$sAttention! Le test `%2$s::%3$s` a quitté pendant son initialisation ou "
"sa finalisation.%4$s\n"
#: src/log/normal.c:67
#: src/log/normal.c:58
#, c-format
msgid "Running %1$s%2$lu%3$s test from %4$s%5$s%6$s:\n"
msgid_plural "Running %1$s%2$lu%3$s tests from %4$s%5$s%6$s:\n"
msgstr[0] "Lancement de %1$s%2$lu%3$s test dans %4$s%5$s%6$s:\n"
msgstr[1] "Lancement de %1$s%2$lu%3$s tests dans %4$s%5$s%6$s:\n"
#: src/log/normal.c:69
#: src/log/normal.c:60
#, c-format
msgid ""
"%1$sSynthesis: Tested: %2$s%3$lu%4$s | Passing: %5$s%6$lu%7$s | Failing: %8$s"
@ -114,7 +114,7 @@ msgstr ""
"%1$sSynthèse: Testés: %2$s%3$lu%4$s | Validés: %5$s%6$lu%7$s | Échoués: %8$s"
"%9$lu%10$s | Plantages: %11$s%12$lu%13$s %14$s\n"
#: src/log/normal.c:85
#: src/log/normal.c:76
#, fuzzy, c-format
msgid "%s::%s: %s\n"
msgstr "%1$s::%2$s: (%3$3.2fs)\n"

View file

@ -24,9 +24,11 @@
#ifndef POSIX_COMPAT_H_
# define POSIX_COMPAT_H_
#if defined(_WIN32) && !defined(__CYGWIN__)
# define VANILLA_WIN32
#endif
# include "config.h"
# if defined(_WIN32) && !defined(__CYGWIN__)
# define VANILLA_WIN32
# endif
# if defined(BSD) \
|| defined(__FreeBSD__) \
@ -45,6 +47,7 @@
# define off64_t _off64_t
# endif
# include <stdio.h>
# include <string.h>
# if defined(__MINGW32__) || defined(__MINGW64__)
# undef off_t
# undef off64_t
@ -62,6 +65,19 @@
# define SIGPROF 27
# define CR_EXCEPTION_TIMEOUT 0xC0001042
# if HAVE_STRTOK_S
# define strtok_r strtok_s
# else
static CR_INLINE char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
return strtok(str, delim);
}
# endif
# ifdef _MSC_VER
# define strdup _strdup
# endif
# else
# include <sys/wait.h>
# endif

View file

@ -36,20 +36,6 @@
#include "config.h"
#include "common.h"
#ifdef VANILLA_WIN32
# if HAVE_STRTOK_S
# define strtok_r strtok_s
# else
static char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
return strtok(str, delim);
}
# endif
#endif
#ifdef _MSC_VER
# define strdup _strdup
#endif
typedef const char *const msg_t;
static msg_t msg_pre_all = N_("Criterion v%s\n");

View file

@ -34,20 +34,6 @@
#include "config.h"
#include "common.h"
#ifdef VANILLA_WIN32
# if HAVE_STRTOK_S
# define strtok_r strtok_s
# else
static char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
return strtok(str, delim);
}
# endif
#endif
#ifdef _MSC_VER
# define strdup _strdup
#endif
static void print_prelude(struct criterion_global_stats *stats) {
criterion_important("TAP version 13\n1.."
CR_SIZE_T_FORMAT