History

Fix tcov align and lock

herman ten brugge committed 5 years ago

Commit 87dcba11 parent f5b84441 file · +7 −2Browse files

Showing the changes to lib (1 of 1 file). Show all

Unified · Split

lib/tcov.c+7−2
@@ -66,7 +66,11 @@ static FILE *open_tcov_file (char *cov_filename) · 65 unmodified lines
6666 while (fcntl (fd, F_SETLKW, &lock) && errno == EINTR)
6767 continue;
6868 #else
69− LockFile((HANDLE)_get_osfhandle(fd), 0, 0, 1, 0);
69+ {
70+ OVERLAPPED overlapped = { 0 };
71+ LockFileEx((HANDLE)_get_osfhandle(fd), LOCKFILE_EXCLUSIVE_LOCK,
72+ 0, 1, 0, &overlapped);
73+ }
7074 #endif
7175
7276 return fdopen (fd, "r+");
@@ -106,6 +110,7 @@ static int sort_line (const void *p, const void *q) · 33 unmodified lines
106110 static tcov_file *sort_test_coverage (unsigned char *p)
107111 {
108112 int i, j, k;
113+ unsigned char *start = p;
109114 tcov_file *file = NULL;
110115 tcov_file *nfile;
111116
@@ -148,7 +153,7 @@ static tcov_file *sort_test_coverage (unsigned char *p) · 36 unmodified lines
148153 tcov_function *func;
149154
150155 p += strlen (function) + 1;
151− p += -(size_t)p & 7;
156+ p += -(p - start) & 7;
152157 for (i = 0; i < nfile->n_func; i++) {
153158 func = &nfile->func[i];
154159 if (strcmp (func->function, function) == 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t