Commit Diff


commit - 68bda3b1b9c8bd7159479cf0c194d755b7d2a7cd
commit + 96cbb59708cdbe5ff619b9d9cccae495277071e5
blob - 4d887779da3647bcf38fded4c8db1d120fb3aaaf
blob + 4310fc7e0269fccc28e40d464196abeb11e6d25f
--- got/Makefile
+++ 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
 
blob - a2d26a315ddbcef3dd58ab256dc2551954b5b8e9
blob + 91c180970a37717bdf0225d089992e356b795ebf
--- lib/buf.c
+++ 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 
 	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);
blob - 6bc2401e2a69421de17eb156eef8c2474229f2ee
blob + dcb2af974a2d41f07e6f11e91b37d73fd2c04948
--- lib/buf.h
+++ 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, con
 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 */
blob - c088b41993852ef4dc4a9cafcb41d7d1a971edb5
blob + 194880901f6ad551e7d4e7ef55668af6c7f0c580
--- lib/diff3.c
+++ 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,13 +269,10 @@ got_merge_diff3(int *overlapcnt, int outfd, const char
 	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)
@@ -313,13 +309,13 @@ got_merge_diff3(int *overlapcnt, int outfd, const char
 		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
 		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
 		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;
 
@@ -401,8 +397,6 @@ out:
 	free(dp23);
 	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)
blob - bbdcd9dec7b562afc193a198bc06d504664e2e6f (mode 644)
blob + /dev/null
--- 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);
-}
blob - bb596178909cc2e981c297f5208f629d2327227f (mode 644)
blob + /dev/null
--- 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
blob - 85f9a8965833c7ec25df706646762df09e50327b
blob + 531c090468f03b4cc3cec7ddbb0b6cd2c7df89a4
--- tog/Makefile
+++ 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