Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8762) remove athing
Home

[Freeciv-Dev] (PR#8762) remove athing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8762) remove athing
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 May 2004 12:48:43 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8762 >

This patch removes athing.  It has no users.  Any future users should 
use specvec instead.

jason

? eff
? flags
? data/diff
? data/flags
Index: utility/astring.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/astring.c,v
retrieving revision 1.8
diff -u -r1.8 astring.c
--- utility/astring.c   14 Nov 2002 09:15:01 -0000      1.8
+++ utility/astring.c   17 May 2004 19:48:15 -0000
@@ -98,59 +98,3 @@
   }
   *astr = zero_astr;
 }
-
-
-/**********************************************************************
-  Initialize the struct; size is the size of one "object",
-  or use 1 if you just want "bytes".
-***********************************************************************/
-void ath_init(struct athing *ath, size_t size)
-{
-  assert(ath != NULL);
-  ath->ptr = NULL;
-  ath->n = 0;
-  ath->n_alloc = 0;
-  ath->size = size;
-}
-
-/**********************************************************************
-  Check that ath has enough size to hold n, and realloc to a bigger
-  size if necessary.  The requested n is stored in ath->n.
-  The actual amount allocated may be larger than n, and is stored
-  in ath->n_alloc.
-***********************************************************************/
-void ath_minnum(struct athing *ath, size_t n)
-{
-  int n1;
-  
-  assert(ath != NULL);
-  assert(ath->size>0);
-  
-  ath->n = n;
-  if (n <= ath->n_alloc) {
-    return;
-  }
-  
-  /* allocated more if this is only a small increase on before: */
-  n1 = (3*(ath->n_alloc+10)) / 2;
-  ath->n_alloc = (n > n1) ? n : n1;
-  ath->ptr = fc_realloc(ath->ptr, ath->n_alloc * ath->size);
-}
-
-/**********************************************************************
-  Free the memory associated with ath, and return ath to same
-  state as after ath_init.
-***********************************************************************/
-void ath_free(struct athing *ath)
-{
-  size_t size;
-
-  assert(ath != NULL);
-  size = ath->size;
-  
-  if (ath->n_alloc > 0) {
-    assert(ath->ptr != NULL);
-    free(ath->ptr);
-  }
-  ath_init(ath, size);
-}
Index: utility/astring.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/astring.h,v
retrieving revision 1.8
diff -u -r1.8 astring.h
--- utility/astring.h   4 Apr 2003 15:47:48 -0000       1.8
+++ utility/astring.h   17 May 2004 19:48:15 -0000
@@ -29,13 +29,6 @@
   size_t n_alloc;              /* total allocated */
 };
 
-struct athing {
-  void *ptr;                   /* the data */
-  size_t size;                 /* size of one object */
-  size_t n;                    /* number most recently requested */
-  size_t n_alloc;              /* total number allocated */
-};
-
 /* Can assign this in variable declaration to initialize:
  * Notice a static astring var is exactly this already.
  * For athing need to call ath_init() due to size.
@@ -46,12 +39,4 @@
 void astr_minsize(struct astring *astr, size_t n);
 void astr_free(struct astring *astr);
 
-void ath_init(struct athing *ath, size_t size);
-void ath_minnum(struct athing *ath, size_t n);
-void ath_free(struct athing *ath);
-
-/* Returns a pointer to the nth (0-based) element in the given athing. Does
-   no boundary or pointer checking */
-#define ath_get(ath,n) ADD_TO_POINTER((ath)->ptr, (ath)->size*(n))
-
 #endif  /* FC__ASTRING_H */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8762) remove athing, Jason Short <=