summaryrefslogtreecommitdiff
path: root/src/util.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix wrong pointer check in git__strdupVicent Marti2010-11-191-1/+1
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Add auxiliary method git__hexdumpVicent Marti2010-08-121-0/+44
| | | | | | | New function in util.c to do a dump of a buffer's contents in hexadecimal to stdout. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix some "signed v unsigned comparison" warnings with -WextraRamsay Jones2010-01-201-1/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix some "signed/unsigned mismatch" (msvc) compiler warningsRamsay Jones2009-06-051-2/+2
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* Fix some (digital-mars) compiler warningsRamsay Jones2009-03-171-2/+2
| | | | | | | | | | | In particular, conditional expressions which contain an assignment statement, where the expression type is not explicitly made to be boolean, elicits the following message: warning 2: possible unintended assignment Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add git__dirname and git__basename utility routinesRamsay Jones2009-01-281-0/+62
| | | | | | | | | | These routines are intended to extract the directory and base name from a path string. Note that these routines do not interact with any filesystem and work only on the text of the path. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add git__fmt as an easier to use snprintfShawn O. Pearce2008-12-311-0/+15
| | | | | | | | Checking the return value of snprintf is a pain, as it must be >= 0 and < sizeof(buffer). git__fmt is a simple wrapper to perform these checks. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add string utility functions for prefix and suffix comparesShawn O. Pearce2008-12-311-0/+20
| | | | Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Wrap malloc and friends and report out of memory as GIT_ENOMEMShawn O. Pearce2008-12-301-0/+26
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>