src/oid.c


Log

Author Commit Date CI Message
Ramsay Jones 552e23ba 2010-06-02T19:16:28 Fix a bug in the git_oid_to_string() function When git_oid_to_string() was passed a buffer size larger than GIT_OID_HEXSZ+1, the function placed the c-string NUL char at the wrong position. Fix the code to place the NUL at the end of the (possibly truncated) oid string. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 0ef9d2aa 2010-01-03T22:56:54 Fix some "signed v unsigned comparison" warnings with -Wextra Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 960ca1d7 2009-08-28T21:22:46 Add the git_oid_to_string() utility function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Shawn O. Pearce 64a47c01 2008-12-30T23:21:36 Wrap malloc and friends and report out of memory as GIT_ENOMEM We now forbid direct use of malloc, strdup or calloc within the library and instead use wrapper functions git__malloc, etc. to invoke the underlying library malloc and set git_errno to a no memory error code if the allocation fails. In the future once we have pack objects in memory we are likely to enhance these routines with garbage collection logic to purge cached pack data when allocations fail. Because the size of the function will grow somewhat large, we don't want to mark them for inline as gcc tends to aggressively inline, creating larger than expected executables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal 213e720c 2008-12-20T20:47:41 Change usages of static inline to GIT_INLINE Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones b3be0fc7 2008-12-03T23:54:47 Fix an "implicit function definition" warning on cygwin In particular, the warning relates to malloc(), which is declared in <stdlib.h>. This header is now included, indirectly, via the "common.h" header. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce af795e49 2008-12-02T09:56:23 Add routines to convert git_oid to hex strings [sp: Credit for some of this implementation goes to Pieter, I started off a patch he proposed for libgit2 but reworked enough of it that I don't want to blame him for any bugs.] Suggested-by: Pieter de Bie <pdebie@ai.rug.nl> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce b7c891c6 2008-11-03T17:31:16 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>
Shawn O. Pearce b3a2f90e 2008-11-03T18:00:49 Enable warnings by default and fix warning in oid.c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 50298f44 2008-11-01T15:55:01 Switch the license from BSD to GPL+libgcc exception Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce d1ea30c3 2008-11-01T15:42:23 Move include files to include/git/, drop git_ prefix from file names Signed-off-by: Shawn O. Pearce <spearce@spearce.org>