git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
a31463ff9af671981a88995e5735e5c96e0c7633 blob 2080 bytes (raw)

  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
 
/*
Copyright 2020 Google LLC

Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/

#include "reftable.h"

#include "basics.h"
#include "system.h"

const char *reftable_error_str(int err)
{
	static char buf[250];
	switch (err) {
	case REFTABLE_IO_ERROR:
		return "I/O error";
	case REFTABLE_FORMAT_ERROR:
		return "corrupt reftable file";
	case REFTABLE_NOT_EXIST_ERROR:
		return "file does not exist";
	case REFTABLE_LOCK_ERROR:
		return "data is outdated";
	case REFTABLE_API_ERROR:
		return "misuse of the reftable API";
	case REFTABLE_ZLIB_ERROR:
		return "zlib failure";
	case REFTABLE_NAME_CONFLICT:
		return "file/directory conflict";
	case REFTABLE_REFNAME_ERROR:
		return "invalid refname";
	case -1:
		return "general error";
	default:
		snprintf(buf, sizeof(buf), "unknown error code %d", err);
		return buf;
	}
}

int reftable_error_to_errno(int err)
{
	switch (err) {
	case REFTABLE_IO_ERROR:
		return EIO;
	case REFTABLE_FORMAT_ERROR:
		return EFAULT;
	case REFTABLE_NOT_EXIST_ERROR:
		return ENOENT;
	case REFTABLE_LOCK_ERROR:
		return EBUSY;
	case REFTABLE_API_ERROR:
		return EINVAL;
	case REFTABLE_ZLIB_ERROR:
		return EDOM;
	default:
		return ERANGE;
	}
}

void *(*reftable_malloc_ptr)(size_t sz) = &malloc;
void *(*reftable_realloc_ptr)(void *, size_t) = &realloc;
void (*reftable_free_ptr)(void *) = &free;

void *reftable_malloc(size_t sz)
{
	return (*reftable_malloc_ptr)(sz);
}

void *reftable_realloc(void *p, size_t sz)
{
	return (*reftable_realloc_ptr)(p, sz);
}

void reftable_free(void *p)
{
	reftable_free_ptr(p);
}

void *reftable_calloc(size_t sz)
{
	void *p = reftable_malloc(sz);
	memset(p, 0, sz);
	return p;
}

void reftable_set_alloc(void *(*malloc)(size_t),
			void *(*realloc)(void *, size_t), void (*free)(void *))
{
	reftable_malloc_ptr = malloc;
	reftable_realloc_ptr = realloc;
	reftable_free_ptr = free;
}

int reftable_fd_write(void *arg, const void *data, size_t sz)
{
	int *fdp = (int *)arg;
	return write(*fdp, data, sz);
}
debug log:

solving a31463ff9a ...
found a31463ff9a in https://public-inbox.org/git/570a8c4bcac54295865ee0fc4514073b59725511.1600283416.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/570a8c4bcac54295865ee0fc4514073b59725511.1600283416.git.gitgitgadget@gmail.com/
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
new file mode 100644
index 0000000000..a31463ff9a

Checking patch reftable/publicbasics.c...
Applied patch reftable/publicbasics.c cleanly.

index at:
100644 a31463ff9af671981a88995e5735e5c96e0c7633	reftable/publicbasics.c

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git