]> git.pld-linux.org Git - packages/cvs-fast-export.git/blob - cvs-fast-export-tsan.patch
- updated to 1.66
[packages/cvs-fast-export.git] / cvs-fast-export-tsan.patch
1 --- cvs-fast-export-1.62/atom.c.orig    2023-12-10 21:33:28.557717340 +0100
2 +++ cvs-fast-export-1.62/atom.c 2023-12-10 21:33:33.707747222 +0100
3 @@ -99,21 +99,22 @@ atom(const char *string)
4      hash_bucket_t      *b;
5      int                        len;
6  
7 -    while ((b = *head)) {
8 -collision:
9 -       if (b->hash == hash && !strcmp(string, b->string))
10 -           return b->string;
11 -       head = &(b->next);
12 -    }
13  #ifdef THREADS
14      if (threads > 1)
15         pthread_mutex_lock(&bucket_mutex);
16  #endif /* THREADS */
17 -    if ((b = *head)) {
18 +    while ((b = *head)) {
19 +collision:
20 +       if (b->hash == hash && !strcmp(string, b->string)) {
21  #ifdef THREADS
22         if (threads > 1)
23             pthread_mutex_unlock(&bucket_mutex);
24  #endif /* THREADS */
25 +           return b->string;
26 +       }
27 +       head = &(b->next);
28 +    }
29 +    if ((b = *head)) {
30         goto collision;
31      }
32  
33 @@ -154,21 +155,22 @@ atom_cvs_number(const cvs_number n)
34      number_bucket_t **head = &number_buckets[bucket];
35      number_bucket_t *b;
36  
37 -    while ((b = *head)) {
38 -    collision:
39 -       if (cvs_number_equal(&b->number, &n))
40 -           return &b->number;
41 -       head = &(b->next);
42 -    }
43  #ifdef THREADS
44      if (threads > 1)
45         pthread_mutex_lock(&number_bucket_mutex);
46  #endif /* THREADS */
47 -    if ((b = *head)) {
48 +    while ((b = *head)) {
49 +    collision:
50 +       if (cvs_number_equal(&b->number, &n)) {
51  #ifdef THREADS
52         if (threads > 1)
53             pthread_mutex_unlock(&number_bucket_mutex);
54  #endif /* THREADS */
55 +           return &b->number;
56 +       }
57 +       head = &(b->next);
58 +    }
59 +    if ((b = *head)) {
60         goto collision;
61      }
62  
63 --- cvs-fast-export-1.62/revcvs.c.orig  2023-05-13 19:35:07.000000000 +0200
64 +++ cvs-fast-export-1.62/revcvs.c       2023-12-10 21:41:28.540502302 +0100
65 @@ -22,6 +22,9 @@
66  #endif
67  
68  const master_dir *root_dir = NULL;
69 +#ifdef THREADS
70 +static pthread_mutex_t root_dir_mutex = PTHREAD_MUTEX_INITIALIZER;
71 +#endif
72  
73  static const char *
74  fileop_name(const char *rectified)
75 @@ -86,21 +89,22 @@ atom_dir(const char* dirname)
76      dir_bucket **head = &dir_buckets[HASH_VALUE(dirname) % DIR_BUCKETS];
77      dir_bucket *b;
78  
79 -    while ((b = *head)) {
80 -    collision:
81 -       if (b->dir.name == dirname)
82 -           return &(b->dir);
83 -       head = &(b->next);
84 -    }
85  #ifdef THREADS
86      if (threads > 1)
87         pthread_mutex_lock(&dir_bucket_mutex);
88  #endif /* THREADS */
89 -    if ((b = *head)) {
90 +    while ((b = *head)) {
91 +    collision:
92 +       if (b->dir.name == dirname) {
93  #ifdef THREADS
94         if (threads > 1)
95             pthread_mutex_unlock(&dir_bucket_mutex);
96  #endif /* THREADS */
97 +           return &(b->dir);
98 +       }
99 +       head = &(b->next);
100 +    }
101 +    if ((b = *head)) {
102         goto collision;
103      }
104      b = xmalloc(sizeof(dir_bucket), __func__);
105 @@ -800,7 +803,15 @@ cvs_master_digest(cvs_file *cvs, cvs_mas
106      cvs_branch *cb;
107      cvs_version        *ctrunk = NULL;
108  
109 +#ifdef THREADS
110 +    if (threads > 1)
111 +       pthread_mutex_lock(&root_dir_mutex);
112 +#endif
113      if (!root_dir) root_dir = atom_dir(atom("\0"));
114 +#ifdef THREADS
115 +    if (threads > 1)
116 +       pthread_mutex_unlock(&root_dir_mutex);
117 +#endif
118      build_rev_master(cvs, master);
119  #if CVSDEBUG
120      char buf[CVS_MAX_REV_LEN];
This page took 0.071758 seconds and 3 git commands to generate.