author | Nicolas Pitre <nico@cam.org> | |
Wed, 17 Oct 2007 01:55:49 +0000 (21:55 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 17 Oct 2007 06:54:57 +0000 (02:54 -0400) | ||
commit | 4049b9cfc082affc6365539138f6f5c546bb5685 | |
tree | 37c698b4622297eba91925d00eeb97094e95f141 | tree | snapshot |
parent | 7ba502c47bda21d060844863991083f4c319d436 | commit | diff |
fix const issues with some functions
Two functions, namely write_idx_file() and open_pack_file(), currently
return a const pointer. However that pointer is either a copy of the
first argument, or set to a malloc'd buffer when that first argument
is null. In the later case it is wrong to qualify that pointer as const
since ownership of the buffer is transferred to the caller to dispose of,
and obviously the free() function is not meant to be passed const
pointers.
Making the return pointer not const causes a warning when the first
argument is returned since that argument is also marked const.
The correct thing to do is therefore to remove the const qualifiers,
avoiding the need for ugly casts only to silence some warnings.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Two functions, namely write_idx_file() and open_pack_file(), currently
return a const pointer. However that pointer is either a copy of the
first argument, or set to a malloc'd buffer when that first argument
is null. In the later case it is wrong to qualify that pointer as const
since ownership of the buffer is transferred to the caller to dispose of,
and obviously the free() function is not meant to be passed const
pointers.
Making the return pointer not const causes a warning when the first
argument is returned since that argument is also marked const.
The correct thing to do is therefore to remove the const qualifiers,
avoiding the need for ugly casts only to silence some warnings.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
builtin-pack-objects.c | diff | blob | history | |
index-pack.c | diff | blob | history | |
pack-write.c | diff | blob | history | |
pack.h | diff | blob | history |