History

Fix tcov align and lock

herman ten brugge committed 5 years ago

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

Unified · Split

lib/tcov.c+7−2
@@ -66,7 +66,11 @@ static FILE *open_tcov_file (char *cov_filename) · 65 unmodified lines
66 while (fcntl (fd, F_SETLKW, &lock) && errno == EINTR)66 while (fcntl (fd, F_SETLKW, &lock) && errno == EINTR)
67 continue;67 continue;
68#else68#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 }
70#endif74#endif
71 75
72 return fdopen (fd, "r+");76 return fdopen (fd, "r+");
@@ -106,6 +110,7 @@ static int sort_line (const void *p, const void *q) · 33 unmodified lines
106static tcov_file *sort_test_coverage (unsigned char *p)110static tcov_file *sort_test_coverage (unsigned char *p)
107{111{
108 int i, j, k;112 int i, j, k;
113 unsigned char *start = p;
109 tcov_file *file = NULL;114 tcov_file *file = NULL;
110 tcov_file *nfile;115 tcov_file *nfile;
111 116
@@ -148,7 +153,7 @@ static tcov_file *sort_test_coverage (unsigned char *p) · 36 unmodified lines
148 tcov_function *func;153 tcov_function *func;
149 154
150 p += strlen (function) + 1;155 p += strlen (function) + 1;
151 p += -(size_t)p & 7;156 p += -(p - start) & 7;
152 for (i = 0; i < nfile->n_func; i++) {157 for (i = 0; i < nfile->n_func; i++) {
153 func = &nfile->func[i];158 func = &nfile->func[i];
154 if (strcmp (func->function, function) == 0)159 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