Code cleanup
This commit is contained in:
parent
59fae773bf
commit
3edc0e83cf
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS System libSystem */
|
/* This file is part of DeforaOS System libSystem */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -95,9 +95,7 @@ int buffer_set_size(Buffer * buffer, size_t size)
|
||||||
{
|
{
|
||||||
char * p;
|
char * p;
|
||||||
|
|
||||||
if(size == 0) /* XXX workaround to avoid freeing the data */
|
if((p = realloc(buffer->data, size)) == NULL && size != 0)
|
||||||
size++;
|
|
||||||
if((p = realloc(buffer->data, size)) == NULL)
|
|
||||||
return error_set_code(1, "%s", strerror(errno));
|
return error_set_code(1, "%s", strerror(errno));
|
||||||
buffer->data = p;
|
buffer->data = p;
|
||||||
if(size > buffer->size)
|
if(size > buffer->size)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user