/* Sparse Arrays for Objective C dispatch tables
- Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1995, 1996, 2002, 2004 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-GNU CC is distributed in the hope that it will be useful,
+GCC 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
-#include "sarray.h"
-#include "runtime.h"
+#include "objc/sarray.h"
+#include "objc/runtime.h"
#include <stdio.h>
#include "assert.h"
#else
old_buckets = array->buckets;
#endif
-
- if ((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
- sarray_free (array->is_copy_of);
/* Free all entries that do not point to empty_bucket */
for (counter = 0; counter <= old_max_index; counter++ ) {
#endif
+ /* If this is a copy of another array, we free it (which might just
+ * decrement its reference count so it will be freed when no longer in use).
+ */
+ if (array->is_copy_of)
+ sarray_free (array->is_copy_of);
+
/* free array */
sarray_free_garbage (array);
}