Commit Graph

4 Commits

Author SHA1 Message Date
Shawn O. Pearce
2dbdb824f0 Add git_fsize to the os file API
This permits us to get the size of an opened file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:52:28 -08:00
Shawn O. Pearce
3e9e69098a Redefine git_fread, git_fwrite to transfer the whole unit
We never want to accept a short read or a short write when
transferring data to or from a local file.

Either the entire read (or write) completes or the operation
failed and we will not recover gracefully from it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:43:04 -08:00
Shawn O. Pearce
b7c891c629 Add git_oid_cpy, git_oid_cmp as inline functions
These are easily built off the standard C library functions memcpy
and memcmp.  By marking these inline we stand a good chance of
the C compiler replacing the entire thing with tight machine code,
because many compilers will actually inline a memcmp or memcpy when
the 3rd argument (the size) is a constant value.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-03 18:43:04 -08:00
Shawn O. Pearce
16a67770b7 Create a micro abstraction around the POSIX file APIs
This way we can start to write IO code to read and write files in the
Git object database, but provide a hook to inject native Win32 APIs
instead so libgit2 can be ported to run natively on that platform.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-11-01 16:53:06 -07:00