Commit fc3c3a20 by Ramsay Jones Committed by Shawn O. Pearce

Avoid using a gcc compiler language extension

In particular, using pointer arithmetic on void pointers,
despite being quite useful, is not legal in standard C.
Avoiding non-standard C constructs will help in porting
the library to other compilers/platforms.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
parent 1906f236
...@@ -125,7 +125,7 @@ void gitfo_free_map(gitfo_map *out) ...@@ -125,7 +125,7 @@ void gitfo_free_map(gitfo_map *out)
struct gitfo_cache { struct gitfo_cache {
git_file fd; git_file fd;
unsigned int cache_size, pos; unsigned int cache_size, pos;
void *cache; unsigned char *cache;
}; };
gitfo_cache *gitfo_enable_caching(git_file fd, size_t cache_size) gitfo_cache *gitfo_enable_caching(git_file fd, size_t cache_size)
...@@ -165,8 +165,10 @@ int gitfo_flush_cached(gitfo_cache *ioc) ...@@ -165,8 +165,10 @@ int gitfo_flush_cached(gitfo_cache *ioc)
return result; return result;
} }
int gitfo_write_cached(gitfo_cache *ioc, void *buf, size_t len) int gitfo_write_cached(gitfo_cache *ioc, void *buff, size_t len)
{ {
unsigned char *buf = buff;
for (;;) { for (;;) {
size_t space_left = ioc->cache_size - ioc->pos; size_t space_left = ioc->cache_size - ioc->pos;
/* cache if it's small */ /* cache if it's small */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment