+Sun Jan 14 23:37:30 EST 2001 Ben Collins <bcollins@debian.org>
+
+ * include/dpkg-db.h: redeclare nfmalloc(), remove obstack definitions
+ * lib/dbmodify.c (modstatdb_init): remove obstack init
+ * lib/nfmalloc.c: redefine nfmalloc to be an inline function. It now checks
+ to make sure db_obs is initliazed.
+ * main/archives.c (tarobject): declare our own obstack, and use it instead
+ (cu_fileslist) just call obstack_free
+ * main/processarc.c: correct calling of cu_fileslist
+
Sun Jan 14 18:23:07 CST 2001 Adam Heath <doogie@debian.org>
* main/dpkg.8: Document --command-fd.
const struct versionrevision *b);
/*** from nfmalloc.c ***/
-
-#include <obstack.h>
-#define obstack_chunk_alloc m_malloc
-#define obstack_chunk_free free
-#define ALIGN_BOUNDARY 64
-#define ALIGN_MASK (ALIGN_BOUNDARY - 1)
-
-extern struct obstack db_obs;
-#define nfmalloc(size) obstack_alloc(&db_obs, size)
+#ifdef HAVE_INLINE
+extern inline void *nfmalloc(size_t);
+#else
+extern void *nfmalloc(size_t);
+#endif
char *nfstrsave(const char*);
char *nfstrnsave(const char*, int);
void nffreeall(void);
{ 0 }
}, *fnip;
- static int obs_inited = 0;
-
admindir= adir;
- if (!obs_inited) {
- obstack_init(&db_obs);
- obs_inited = 1;
- }
-
for (fnip=fnis; fnip->suffix; fnip++) {
free(*fnip->store);
*fnip->store= m_malloc(strlen(adir)+strlen(fnip->suffix)+2);
#include <config.h>
#include <dpkg.h>
-
-/* This also defines our obstack usage */
#include <dpkg-db.h>
-struct obstack db_obs;
-int ob_init = 0;
+#include <obstack.h>
+
+#define obstack_chunk_alloc m_malloc
+#define obstack_chunk_free free
+#define ALIGN_BOUNDARY 64
+#define ALIGN_MASK (ALIGN_BOUNDARY - 1)
+
+static struct obstack db_obs;
+static int dbobs_init = 0;
+
+#ifdef HAVE_INLINE
+inline void *nfmalloc(size_t size)
+#else
+void *nfmalloc(size_t size)
+#endif
+{
+ if (!dbobs_init) { obstack_init(&db_obs); dbobs_init = 1; }
+ return obstack_alloc(&db_obs, size);
+}
char *nfstrsave(const char *string) {
int i = strlen(string) + 1;
#include <sys/stat.h>
#include <sys/types.h>
+#include <obstack.h>
+#define obstack_chunk_alloc m_malloc
+#define obstack_chunk_free free
+
#include <config.h>
#include <dpkg.h>
#include <dpkg-db.h>
filename, r ? strerror(e) : "OK");
errno= e; return r;
}
-
+
+static struct obstack tar_obs;
+static int tarobs_init = 0;
+
int tarobject(struct TarInfo *ti) {
static struct varbuf conffderefn, hardlinkfn, symlinkfn;
const char *usename;
struct filepackages *packageslump;
mode_t am;
+ if (!tarobs_init) {
+ obstack_init(&tar_obs);
+ tarobs_init = 1;
+ }
+
/* Append to list of files.
* The trailing / put on the end of names in tarfiles has already
* been stripped by TarExtractor (lib/tarfn.c).
*/
- nifd= m_malloc(sizeof(struct fileinlist));
+ nifd= obstack_alloc(&tar_obs, sizeof(struct fileinlist));
nifd->namenode= findnamenode(ti->Name, 0);
nifd->next= 0; *tc->newfilesp= nifd; tc->newfilesp= &nifd->next;
nifd->namenode->flags |= fnnf_new_inarchive;
}
}
pdep->up->up->clientdata->istobe= itb_deconfigure;
- newdeconf= m_malloc(sizeof(struct packageinlist));
+ newdeconf= obstack_alloc(&tar_obs, sizeof(struct packageinlist));
newdeconf->next= deconfigure;
newdeconf->pkg= pdep->up->up;
deconfigure= newdeconf;
}
void cu_fileslist(int argc, void **argv) {
- struct fileinlist **headp= (struct fileinlist**)argv[0];
- struct fileinlist *current, *next;
- for (current= *headp; current; current= next) {
- next= current->next;
- free(current);
+ if (tarobs_init) {
+ obstack_free(&tar_obs, 0);
+ tarobs_init = 0;
}
}
* hashes across.
*/
newconffiles= 0; newconffileslastp= &newconffiles;
- push_cleanup(cu_fileslist,~0, 0,0, 1,(void*)&newconffiles);
+ push_cleanup(cu_fileslist,~0, 0, 0, 0);
strcpy(cidirrest,CONFFILESFILE);
conff= fopen(cidir,"r");
if (conff) {
close(p1[1]);
newfileslist= 0; tc.newfilesp= &newfileslist;
- push_cleanup(cu_fileslist,~0, 0,0, 1,(void*)&newfileslist);
+ push_cleanup(cu_fileslist,~0, 0, 0, 0);
tc.pkg= pkg;
tc.backendpipe= p1[0];
push_cleanup(cu_closefd,~ehflag_bombout, 0,0, 1,(void*)&tc.backendpipe);