remove worklist code; it was only used to unlink files which we already unlink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
diff --git a/got/Makefile b/got/Makefile
index 4d88777..4310fc7 100644
--- a/got/Makefile
+++ b/got/Makefile
@@ -7,7 +7,7 @@ SRCS= got.c blame.c commit_graph.c delta.c diff.c \
diffreg.c error.c fileindex.c object.c object_cache.c \
object_idset.c object_parse.c opentemp.c path.c pack.c \
privsep.c reference.c repository.c sha1.c worktree.c \
- inflate.c buf.c worklist.c rcsutil.c diff3.c lockfile.c \
+ inflate.c buf.c rcsutil.c diff3.c lockfile.c \
deflate.c object_create.c
MAN = ${PROG}.1 got-worktree.5 git-repository.5
diff --git a/lib/buf.c b/lib/buf.c
index a2d26a3..91c1809 100644
--- a/lib/buf.c
+++ b/lib/buf.c
@@ -36,7 +36,6 @@
#include <unistd.h>
#include "buf.h"
-#include "worklist.h"
#include "got_error.h"
@@ -323,7 +322,7 @@ buf_write(BUF *b, const char *path, mode_t mode)
* NB. This function will modify <template>, as per mkstemp
*/
const struct got_error *
-buf_write_stmp(BUF *b, char *template, struct wklhead *temp_files)
+buf_write_stmp(BUF *b, char *template)
{
const struct got_error *err = NULL;
int fd;
@@ -331,8 +330,6 @@ buf_write_stmp(BUF *b, char *template, struct wklhead *temp_files)
if ((fd = mkstemp(template)) == -1)
return got_error_from_errno("mkstemp");
- worklist_add(template, temp_files);
-
if (buf_write_fd(b, fd) == -1) {
err = got_error_from_errno("buf_write_fd");
(void)unlink(template);
diff --git a/lib/buf.h b/lib/buf.h
index 6bc2401..dcb2af9 100644
--- a/lib/buf.h
+++ b/lib/buf.h
@@ -41,7 +41,6 @@
#include <sys/types.h>
typedef struct buf BUF;
-struct wklhead;
const struct got_error *buf_alloc(BUF **, size_t);
const struct got_error *buf_load(BUF **, const char *);
@@ -55,7 +54,7 @@ const struct got_error *buf_puts(size_t *, BUF *b, const char *str);
size_t buf_len(BUF *);
int buf_write_fd(BUF *, int);
const struct got_error *buf_write(BUF *, const char *, mode_t);
-const struct got_error *buf_write_stmp(BUF *, char *, struct wklhead *);
+const struct got_error *buf_write_stmp(BUF *, char *);
u_char *buf_get(BUF *b);
#endif /* BUF_H */
diff --git a/lib/diff3.c b/lib/diff3.c
index c088b41..1948809 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -83,7 +83,6 @@
#include "buf.h"
#include "rcsutil.h"
#include "got_lib_diff.h"
-#include "worklist.h"
#ifndef nitems
#define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
@@ -270,14 +269,11 @@ got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
BUF *b1, *b2, *b3, *d1, *d2, *diffb;
u_char *data, *patch;
size_t dlen, plen;
- struct wklhead temp_files;
struct diff3_state *d3s;
int i;
*overlapcnt = 0;
- SLIST_INIT(&temp_files);
-
d3s = calloc(1, sizeof(*d3s));
if (d3s == NULL)
return got_error_from_errno("calloc");
@@ -313,13 +309,13 @@ got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
goto out;
}
- err = buf_write_stmp(b1, path1, &temp_files);
+ err = buf_write_stmp(b1, path1);
if (err)
goto out;
- err = buf_write_stmp(b2, path2, &temp_files);
+ err = buf_write_stmp(b2, path2);
if (err)
goto out;
- err = buf_write_stmp(b3, path3, &temp_files);
+ err = buf_write_stmp(b3, path3);
if (err)
goto out;
@@ -344,7 +340,7 @@ got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
err = got_error_from_errno("asprintf");
goto out;
}
- err = buf_write_stmp(d1, dp13, &temp_files);
+ err = buf_write_stmp(d1, dp13);
if (err)
goto out;
@@ -355,7 +351,7 @@ got_merge_diff3(int *overlapcnt, int outfd, const char *p1, const char *p2,
err = got_error_from_errno("asprintf");
goto out;
}
- err = buf_write_stmp(d2, dp23, &temp_files);
+ err = buf_write_stmp(d2, dp23);
if (err)
goto out;
@@ -402,8 +398,6 @@ out:
free(data);
free(patch);
- worklist_clean(&temp_files, worklist_unlink);
-
for (i = 0; i < nitems(d3s->fp); i++) {
if (d3s->fp[i] && fclose(d3s->fp[i]) != 0 && err == NULL)
err = got_error_from_errno("fclose");
diff --git a/lib/worklist.c b/lib/worklist.c
deleted file mode 100644
index bbdcd9d..0000000
--- a/lib/worklist.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: worklist.c,v 1.4 2015/06/13 20:15:21 nicm Exp $ */
-/*
- * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/queue.h>
-
-#include <err.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "worklist.h"
-#include "got_error.h"
-
-/*
- * adds a path to a worklist.
- */
-const struct got_error *
-worklist_add(const char *path, struct wklhead *worklist)
-{
- size_t len;
- struct worklist *wkl;
- sigset_t old, new;
-
- wkl = calloc(1, sizeof(*wkl));
- if (wkl == NULL)
- return got_error_from_errno("calloc");
-
- len = strlcpy(wkl->wkl_path, path, sizeof(wkl->wkl_path));
- if (len >= sizeof(wkl->wkl_path)) {
- free(wkl);
- return got_error(GOT_ERR_NO_SPACE);
- }
-
- sigfillset(&new);
- sigprocmask(SIG_BLOCK, &new, &old);
- SLIST_INSERT_HEAD(worklist, wkl, wkl_list);
- sigprocmask(SIG_SETMASK, &old, NULL);
- return NULL;
-}
-
-/*
- * run over the given worklist, calling cb for each element.
- * this is just like worklist_clean(), except we block signals first.
- */
-void
-worklist_run(struct wklhead *list, void (*cb)(struct worklist *))
-{
- sigset_t old, new;
- struct worklist *wkl;
-
- sigfillset(&new);
- sigprocmask(SIG_BLOCK, &new, &old);
-
- worklist_clean(list, cb);
-
- while ((wkl = SLIST_FIRST(list)) != NULL) {
- SLIST_REMOVE_HEAD(list, wkl_list);
- free(wkl);
- }
-
- sigprocmask(SIG_SETMASK, &old, NULL);
-}
-
-/*
- * pass elements to the specified callback, which has to be signal safe.
- */
-void
-worklist_clean(struct wklhead *list, void (*cb)(struct worklist *))
-{
- struct worklist *wkl;
-
- SLIST_FOREACH(wkl, list, wkl_list)
- cb(wkl);
-}
-
-void
-worklist_unlink(struct worklist *wkl)
-{
- (void)unlink(wkl->wkl_path);
-}
diff --git a/lib/worklist.h b/lib/worklist.h
deleted file mode 100644
index bb59617..0000000
--- a/lib/worklist.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: worklist.h,v 1.4 2015/01/16 06:40:11 deraadt Exp $ */
-/*
- * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WORKLIST_H
-#define WORKLIST_H
-
-#include <sys/types.h>
-#include <limits.h>
-
-struct worklist {
- char wkl_path[PATH_MAX];
- volatile SLIST_ENTRY(worklist) wkl_list;
-};
-
-SLIST_HEAD(wklhead, worklist);
-
-const struct got_error *worklist_add(const char *, struct wklhead *);
-void worklist_run(struct wklhead *, void (*cb)(struct worklist *));
-void worklist_clean(struct wklhead *, void (*cb)(struct worklist *));
-
-void worklist_unlink(struct worklist *);
-
-#endif
diff --git a/tog/Makefile b/tog/Makefile
index 85f9a89..531c090 100644
--- a/tog/Makefile
+++ b/tog/Makefile
@@ -7,7 +7,7 @@ SRCS= tog.c blame.c commit_graph.c delta.c diff.c \
diffreg.c error.c fileindex.c object.c object_cache.c \
object_idset.c object_parse.c opentemp.c path.c pack.c \
privsep.c reference.c repository.c sha1.c worktree.c \
- utf8.c inflate.c buf.c worklist.c rcsutil.c diff3.c \
+ utf8.c inflate.c buf.c rcsutil.c diff3.c \
lockfile.c deflate.c object_create.c
MAN = ${PROG}.1