summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0f0e89)
raw | patch | inline | side by side (parent: e0f0e89)
author | Jason McMullan <jason.mcmullan@timesys.com> | |
Fri, 3 Jun 2005 15:05:39 +0000 (11:05 -0400) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Wed, 8 Jun 2005 20:04:53 +0000 (13:04 -0700) |
Make 'sha1' parameters const where possible
Signed-off-by: Jason McMullan <jason.mcmullan@timesys.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Jason McMullan <jason.mcmullan@timesys.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
blob.c | patch | blob | history | |
blob.h | patch | blob | history | |
cache.h | patch | blob | history | |
commit.c | patch | blob | history | |
commit.h | patch | blob | history | |
delta.c | patch | blob | history | |
delta.h | patch | blob | history | |
object.c | patch | blob | history | |
object.h | patch | blob | history | |
sha1_file.c | patch | blob | history | |
tag.c | patch | blob | history | |
tag.h | patch | blob | history | |
tree.c | patch | blob | history | |
tree.h | patch | blob | history |
index c800cd3905e2a4e97098064a588e15c0ae33a0b0..ea52ad5c9d819721ff6f631d7d5b3057fabcd633 100644 (file)
--- a/blob.c
+++ b/blob.c
const char *blob_type = "blob";
-struct blob *lookup_blob(unsigned char *sha1)
+struct blob *lookup_blob(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj) {
index 8004c835e73d44f3d9f0adf533cbf2475c288b42..ea5d9e9f8b63be2c7048d19ee53feb06b0795c80 100644 (file)
--- a/blob.h
+++ b/blob.h
struct object object;
};
-struct blob *lookup_blob(unsigned char *sha1);
+struct blob *lookup_blob(const unsigned char *sha1);
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
index 74307f18296a6ef00f1839cc62d7560db1b916d6..6a7525afc982166430b6277cc756c8911f9b2bdb 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -167,7 +167,7 @@ extern void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, uns
extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size);
extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
-extern int check_sha1_signature(unsigned char *sha1, void *buf, unsigned long size, const char *type);
+extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type);
/* Read a tree into the cache */
extern int read_tree(void *buffer, unsigned long size, int stage);
diff --git a/commit.c b/commit.c
index 21ac2fe9d71832896c21cae6528a2355068e654a..9fa03ef03000979d4a798c8e22cd2074e7c9d48d 100644 (file)
--- a/commit.c
+++ b/commit.c
const char *commit_type = "commit";
-static struct commit *check_commit(struct object *obj, unsigned char *sha1)
+static struct commit *check_commit(struct object *obj, const unsigned char *sha1)
{
if (obj->type != commit_type) {
error("Object %s is a %s, not a commit",
return (struct commit *) obj;
}
-struct commit *lookup_commit_reference(unsigned char *sha1)
+struct commit *lookup_commit_reference(const unsigned char *sha1)
{
struct object *obj = parse_object(sha1);
return check_commit(obj, sha1);
}
-struct commit *lookup_commit(unsigned char *sha1)
+struct commit *lookup_commit(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj) {
diff --git a/commit.h b/commit.h
index 51d95764ab121257ebba0050d54146f11188d2c2..57c1b62faf2b0e4dffcfec45baa6bdf1ce883350 100644 (file)
--- a/commit.h
+++ b/commit.h
extern const char *commit_type;
-struct commit *lookup_commit(unsigned char *sha1);
-struct commit *lookup_commit_reference(unsigned char *sha1);
+struct commit *lookup_commit(const unsigned char *sha1);
+struct commit *lookup_commit_reference(const unsigned char *sha1);
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
index b31957a1d38046b9ead2569bbdd59be061f0157b..db85989e71b7f33c4ddd80ae9b1cbad10461856a 100644 (file)
--- a/delta.c
+++ b/delta.c
} u;
};
-struct delta *lookup_delta(unsigned char *sha1)
+struct delta *lookup_delta(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj) {
index 8e4efdf4acb568a4bd439884911d0ee947bd7f92..df97ff84f7e45ec2d45fc613576d91057e2b5d61 100644 (file)
--- a/delta.h
+++ b/delta.h
/* handling of delta objects */
struct delta;
struct object_list;
-extern struct delta *lookup_delta(unsigned char *sha1);
+extern struct delta *lookup_delta(const unsigned char *sha1);
extern int parse_delta_buffer(struct delta *item, void *buffer, unsigned long size);
extern int parse_delta(struct delta *item, unsigned char sha1);
extern int process_deltas(void *src, unsigned long src_size,
diff --git a/object.c b/object.c
index 5e72a7878488922cfeeb5dba385d72049253f7c3..5e8378857028afeb4d1cd91c0de26c8414e137de 100644 (file)
--- a/object.c
+++ b/object.c
int nr_objs;
static int obj_allocs;
-static int find_object(unsigned char *sha1)
+static int find_object(const unsigned char *sha1)
{
int first = 0, last = nr_objs;
return -first-1;
}
-struct object *lookup_object(unsigned char *sha1)
+struct object *lookup_object(const unsigned char *sha1)
{
int pos = find_object(sha1);
if (pos >= 0)
return NULL;
}
-void created_object(unsigned char *sha1, struct object *obj)
+void created_object(const unsigned char *sha1, struct object *obj)
{
int pos = find_object(sha1);
}
}
-struct object *parse_object(unsigned char *sha1)
+struct object *parse_object(const unsigned char *sha1)
{
unsigned long mapsize;
void *map = map_sha1_file(sha1, &mapsize);
diff --git a/object.h b/object.h
index cde8471b56eb351152c3532a2f669208b3eb13bb..ca455d57117af5f15e83b791a336351b43af6716 100644 (file)
--- a/object.h
+++ b/object.h
extern int nr_objs;
extern struct object **objs;
-struct object *lookup_object(unsigned char *sha1);
+struct object *lookup_object(const unsigned char *sha1);
-void created_object(unsigned char *sha1, struct object *obj);
+void created_object(const unsigned char *sha1, struct object *obj);
/** Returns the object, having parsed it to find out what it is. **/
-struct object *parse_object(unsigned char *sha1);
+struct object *parse_object(const unsigned char *sha1);
void add_ref(struct object *refer, struct object *target);
diff --git a/sha1_file.c b/sha1_file.c
index 7cfd43c51ba20ee85fe6056c67bbc88cc90dad81..e648c068b558fbdbbdc866c8829af3641e2c5b60 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
return NULL;
}
-int check_sha1_signature(unsigned char *sha1, void *map, unsigned long size, const char *type)
+int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long size, const char *type)
{
char header[100];
unsigned char real_sha1[20];
index 26494ca9695fdd2e81952378f64bbc361698117d..4041af2572a4427a03bc8955137b7d2211f9d770 100644 (file)
--- a/tag.c
+++ b/tag.c
const char *tag_type = "tag";
-struct tag *lookup_tag(unsigned char *sha1)
+struct tag *lookup_tag(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj) {
index 41826870f87aaa2e45f34b825aa2c7c63aa81d80..3e8c32d738ddad2538257b84830424a77b9aae7a 100644 (file)
--- a/tag.h
+++ b/tag.h
char *signature; /* not actually implemented */
};
-extern struct tag *lookup_tag(unsigned char *sha1);
+extern struct tag *lookup_tag(const unsigned char *sha1);
extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
extern int parse_tag(struct tag *item);
index aa55ddb6846bdc33abf9d41424d105e1b2331640..2432f09a0259613b055a5ffed020dc56abc79f12 100644 (file)
--- a/tree.c
+++ b/tree.c
return read_tree_recursive(buffer, size, "", 0, stage);
}
-struct tree *lookup_tree(unsigned char *sha1)
+struct tree *lookup_tree(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj) {
index 056bd86fa9e5a62207bd52fbb124f080e8854253..74fe09d7634661d208f88536cf831c3858766450 100644 (file)
--- a/tree.h
+++ b/tree.h
struct tree_entry_list *entries;
};
-struct tree *lookup_tree(unsigned char *sha1);
+struct tree *lookup_tree(const unsigned char *sha1);
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);