Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fuzz/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ static void test_all_from(const char *dirname)

int main(int argc, char **argv)
{
const char *target = strrchr(argv[0], '/');
char corporadir[1024];

/* if VALGRIND testing is enabled, we have to call ourselves with valgrind checking */
if (argc == 1) {
const char *valgrind = getenv("TESTS_VALGRIND");
Expand All @@ -108,10 +111,8 @@ int main(int argc, char **argv)
}
}

const char *target = strrchr(argv[0], '/');
target = target ? target + 1 : argv[0];

char corporadir[1024];
snprintf(corporadir, sizeof(corporadir), SRCDIR "/%s.in", target);

test_all_from(corporadir);
Expand Down
2 changes: 1 addition & 1 deletion src/psl.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ static int domain_to_punycode(const char *domain, char *out, size_t outsize)
memcpy(out + outlen, "xn--", 4);
outlen += 4;

labellen = outsize - outlen - (e != NULL) - 1; // -1 to leave space for the trailing \0
labellen = outsize - outlen - (e != NULL) - 1; /* -1 to leave space for the trailing \0 */
if (punycode_encode(inputlen, input, &labellen, out + outlen))
return 1;
outlen += labellen;
Expand Down
7 changes: 4 additions & 3 deletions tests/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
* This file is part of the test suite of libpsl.
*/

#include <stdio.h> // snprintf
#include <stdlib.h> // exit, system
#include <string.h> // strlen
#include <stdio.h> /* snprintf */
#include <stdlib.h> /* exit, system */
#include <string.h> /* strlen */
#if defined _WIN32
# include <malloc.h>
#endif
#include "common.h"

int run_valgrind(const char *valgrind, const char *executable)
{
Expand Down
4 changes: 2 additions & 2 deletions tools/psl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#endif

#ifdef _WIN32
// Windows does not have localtime_r but has localtime_s, which is more or less
// the same except that the arguments are reversed
/* Windows does not have localtime_r but has localtime_s, which is more or less
the same except that the arguments are reversed. */
# define LOCALTIME_R_SUCCESSFUL(t_sec, t_now) \
(localtime_s(t_now, t_sec) == 0)
#else
Expand Down
Loading