Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-02-27 07:28:31 +0400
committerVicent Martí <tanoku@gmail.com>2012-02-27 08:30:07 +0400
commit13224ea4aad9a1b3c9cc4c992ceaea9af623e047 (patch)
treeb5c3a503d1ef7ba6269bf4291530c4e8e5936bdb /src/buffer.h
parente07c2d225deec42e592133df49ad8c564d4d66c7 (diff)
buffer: Unify `git_fbuffer` and `git_buf`
This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 3969f461e..3e9cb1713 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -11,7 +11,7 @@
typedef struct {
char *ptr;
- ssize_t asize, size;
+ size_t asize, size;
} git_buf;
extern char git_buf_initbuf[];
@@ -47,7 +47,7 @@ int git_buf_try_grow(git_buf *buf, size_t target_size);
void git_buf_free(git_buf *buf);
void git_buf_swap(git_buf *buf_a, git_buf *buf_b);
char *git_buf_detach(git_buf *buf);
-void git_buf_attach(git_buf *buf, char *ptr, ssize_t asize);
+void git_buf_attach(git_buf *buf, char *ptr, size_t asize);
/**
* Test if there have been any reallocation failures with this git_buf.
@@ -83,7 +83,7 @@ int git_buf_puts(git_buf *buf, const char *string);
int git_buf_printf(git_buf *buf, const char *format, ...) GIT_FORMAT_PRINTF(2, 3);
void git_buf_clear(git_buf *buf);
void git_buf_consume(git_buf *buf, const char *end);
-void git_buf_truncate(git_buf *buf, ssize_t len);
+void git_buf_truncate(git_buf *buf, size_t len);
void git_buf_rtruncate_at_char(git_buf *path, char separator);
int git_buf_join_n(git_buf *buf, char separator, int nbuf, ...);
@@ -115,4 +115,7 @@ GIT_INLINE(int) git_buf_rfind_next(git_buf *buf, char ch)
return idx;
}
+/* Remove whitespace from the end of the buffer */
+void git_buf_rtrim(git_buf *buf);
+
#endif