--- ed-1.2/carg_parser.c.old 2009-01-15 06:24:29.000000000 -0500
+++ ed-1.2/carg_parser.c 2009-04-12 11:39:56.000000000 -0400
@@ -14,21 +14,20 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
#include
#include
#include "carg_parser.h"
-
/* assure at least a minimum size for buffer `buf' */
-char ap_resize_buffer( void *buf, const int min_size )
+char ap_resize_buffer( void **buf, const int min_size )
{
- void *new_buf = 0;
- if( *(void **)buf ) new_buf = realloc( *(void **)buf, min_size );
- else new_buf = malloc( min_size );
- if( !new_buf ) return 0;
- *(void **)buf = new_buf;
+ void *old_buf = *buf;
+ *buf = realloc(*buf, min_size);
+ if (*buf == NULL) {
+ *buf = old_buf;
+ return 0;
+ }
return 1;
}