Skip to content

Commit 01162c5

Browse files
committed
move from ssize_t to the C standard based ptrdiff_t
1 parent 016cf82 commit 01162c5

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

extensions/autolink.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22
#include <parser.h>
33
#include <string.h>
44
#include <utf8.h>
5+
#include <stddef.h>
56

67
#if defined(_WIN32)
78
#define strncasecmp _strnicmp
89
#else
910
#include <strings.h>
1011
#endif
1112

12-
// for ssize_t
13-
#ifdef _MSC_VER
14-
#include <BaseTsd.h>
15-
typedef SSIZE_T ssize_t;
16-
#else
17-
#include <unistd.h>
18-
#endif
19-
2013
static int is_valid_hostchar(const uint8_t *link, size_t link_len) {
2114
int32_t ch;
2215
int r = cmark_utf8proc_iterate(link, (bufsize_t)link_len, &ch);
@@ -314,7 +307,7 @@ static bool validate_protocol(char protocol[], uint8_t *data, size_t rewind, siz
314307
return true;
315308
}
316309

317-
char prev_char = data[-((ssize_t)rewind) - len - 1];
310+
char prev_char = data[-((ptrdiff_t)rewind) - len - 1];
318311

319312
// Make sure the character before the protocol is non-alphanumeric
320313
return !cmark_isalnum(prev_char);

0 commit comments

Comments
 (0)