* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
-#include <string.h> /* memmove(1) */
-
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
#include "xarray.h"
+/* local prototypes */
+XSTATIC XArray * xarray_New (unsigned int);
+
+
#define XARRAY_ASSERT_NOT_NULL(xarray) \
{ \
if (xarray == NULL) return XARRAY_ENULLPOINTER; \
#define XARRAY_BOUNDS_CHECK(xarray, index) \
{ \
- if (index < 0) \
- return XARRAY_ENEGATIVEINDEX; \
- else if (xarray->last_valid_element != -1 && \
+ if (xarray->last_valid_element != -1 && \
(int) index > xarray->last_valid_element) \
return XARRAY_EINDEXTOOLARGE; \
}
new_xarray = (XArray *) malloc (sizeof(XArray));
if (new_xarray == NULL) return NULL;
- if (initial_size_hint <= 0)
+ if (initial_size_hint == 0)
initial_size = XARRAY_DEFAULT_SIZE;
else
initial_size = initial_size_hint;
dummy_reference = xarray_ObjectAtIndex;
dummy_reference = xarray_Count;
}
-
+
return new_xarray;
}
xarray->array[xarray->last_valid_element] = NULL;
--xarray->last_valid_element;
- return XARRAY_SUCCESS;
+ return XARRAY_SUCCESS;
}
XSTATIC int xarray_RemoveObjects (XArray *xarray, unsigned int at_index,