Commit 075e52b7 authored by Bernhard Link's avatar Bernhard Link

Introduce bool_t

parent 803c76b5
2004-12-30 Bernhard R. Link <brlink@debian.org>
* Tidy up (introduce bool_t and replace dpkgversion_isNewer)
2004-12-24 Bernhard R. Link <brlink@debian.org>
* Fixed a boolean inversion in the check if | is allowed
in formulas.
......
......@@ -334,7 +334,7 @@ static inline retvalue sendconfig(struct aptmethod *method) {
size_t l;
const char *p;
char *c;
int wasnewline;
bool_t wasnewline;
assert(method->command == NULL);
......@@ -363,16 +363,16 @@ static inline retvalue sendconfig(struct aptmethod *method) {
strcpy(c,CONF601 CONFITEM);
c += sizeof(CONF601)+sizeof(CONFITEM)-2;
wasnewline = 1;
wasnewline = TRUE;
for( p = method->config; *p ; p++ ) {
if( *p != '\n' ) {
if( !wasnewline || !isspace(*p) )
*(c++) = *p;
wasnewline = 0;
wasnewline = FALSE;
} else {
strcpy(c,CONFITEM);
c += sizeof(CONFITEM)-1;
wasnewline = 1;
wasnewline = TRUE;
}
}
*(c++) = '\n';
......
......@@ -79,7 +79,7 @@ static retvalue binaries_parse_chunk(const char *chunk,const char *packagename,c
assert(packagename);
/* get the sourcename */
r = chunk_getname(chunk,"Source",&mysourcename,1);
r = chunk_getname(chunk,"Source",&mysourcename,TRUE);
if( r == RET_NOTHING ) {
mysourcename = strdup(packagename);
if( !mysourcename )
......
......@@ -382,7 +382,7 @@ static retvalue changes_read(const char *filename,struct changes **changes,const
R;
r = check(filename,c,"Date",force);
R;
r = chunk_getname(c->control,"Source",&c->source,0);
r = chunk_getname(c->control,"Source",&c->source,FALSE);
E("Missing 'Source' field");
r = names_checkpkgname(c->source);
C("Malforce Source-field");
......@@ -534,7 +534,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,const
int i;
struct fileentry *e;
retvalue r = RET_OK;
int havedsc=0, haveorig=0, havetar=0, havediff=0;
bool_t havedsc=FALSE, haveorig=FALSE, havetar=FALSE, havediff=FALSE;
/* First check for each given architecture, if it has files: */
if( forcearchitecture ) {
......@@ -569,7 +569,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,const
fprintf(stderr,"I don't know what to do with multiple .dsc files in '%s'!\n",filename);
return RET_ERROR;
}
havedsc = 1;
havedsc = TRUE;
calculatedname = calc_source_basename(changes->source,changes->version);
if( calculatedname == NULL )
return RET_ERROR_OOM;
......@@ -584,19 +584,19 @@ static retvalue changes_check(const char *filename,struct changes *changes,const
fprintf(stderr,"I don't know what to do with multiple .diff files in '%s'!\n",filename);
return RET_ERROR;
}
havediff = 1;
havediff = TRUE;
} else if( e->type == fe_ORIG ) {
if( haveorig ) {
fprintf(stderr,"I don't know what to do with multiple .orig.tar.gz files in '%s'!\n",filename);
return RET_ERROR;
}
haveorig = 1;
haveorig = TRUE;
} else if( e->type == fe_TAR ) {
if( havetar ) {
fprintf(stderr,"I don't know what to do with multiple .tar.gz files in '%s'!\n",filename);
return RET_ERROR;
}
havetar = 1;
havetar = TRUE;
}
e = e->next;
......@@ -669,7 +669,7 @@ static retvalue changes_includefiles(filesdb filesdb,const char *filename,struct
static retvalue changes_includepkgs(const char *dbdir,DB *references,filesdb filesdb,struct distribution *distribution,struct changes *changes,const struct overrideinfo *srcoverride,const struct overrideinfo *binoverride,int force) {
struct fileentry *e;
retvalue r;
int somethingwasmissed = 0;
bool_t somethingwasmissed = FALSE;
r = RET_NOTHING;
......@@ -693,7 +693,7 @@ static retvalue changes_includepkgs(const char *dbdir,DB *references,filesdb fil
binoverride,
force,D_INPLACE);
if( r == RET_NOTHING )
somethingwasmissed = 1;
somethingwasmissed = TRUE;
} else if( e->type == fe_UDEB ) {
r = deb_add(dbdir,references,filesdb,
e->component,e->architecture,
......@@ -704,7 +704,7 @@ static retvalue changes_includepkgs(const char *dbdir,DB *references,filesdb fil
binoverride,
force,D_INPLACE);
if( r == RET_NOTHING )
somethingwasmissed = 1;
somethingwasmissed = TRUE;
} else if( e->type == fe_DSC ) {
assert(changes->srccomponent);
assert(changes->srcdirectory);
......@@ -716,7 +716,7 @@ static retvalue changes_includepkgs(const char *dbdir,DB *references,filesdb fil
srcoverride,
force,D_INPLACE);
if( r == RET_NOTHING )
somethingwasmissed = 1;
somethingwasmissed = TRUE;
}
free(fullfilename);
......
......@@ -134,7 +134,7 @@ retvalue deb_read(struct debpackage **pkg, const char *filename) {
/* first look for fields that should be there */
r = chunk_getname(deb->control,"Package",&deb->package,0);
r = chunk_getname(deb->control,"Package",&deb->package,FALSE);
if( r == RET_NOTHING ) {
fprintf(stderr,"Missing 'Package' field in %s!\n",filename);
r = RET_ERROR;
......@@ -165,7 +165,7 @@ retvalue deb_read(struct debpackage **pkg, const char *filename) {
}
/* can be there, otherwise we also know what it is */
r = chunk_getname(deb->control,"Source",&deb->source,1);
r = chunk_getname(deb->control,"Source",&deb->source,TRUE);
if( r == RET_NOTHING ) {
deb->source = strdup(deb->package);
if( deb->source == NULL )
......@@ -419,7 +419,7 @@ retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
r = target_initpackagesdb(t,dbdir);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,0);
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,FALSE);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
}
......@@ -429,7 +429,7 @@ retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
r = target_initpackagesdb(t,dbdir);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,0);
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,FALSE);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
}
......@@ -442,7 +442,7 @@ retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
r = target_initpackagesdb(t,dbdir);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,0);
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,FALSE);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
}
......
......@@ -162,7 +162,7 @@ static retvalue dsc_read(struct dscpackage **pkg, const char *filename) {
/* first look for fields that should be there */
r = chunk_getname(dsc->control,"Source",&dsc->package,0);
r = chunk_getname(dsc->control,"Source",&dsc->package,FALSE);
if( r == RET_NOTHING ) {
fprintf(stderr,"Missing 'Source'-header in %s!\n",filename);
r = RET_ERROR;
......@@ -462,7 +462,7 @@ retvalue dsc_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
r = target_initpackagesdb(t,dbdir);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,0);
r = target_addpackage(t,references,pkg->package,pkg->version,pkg->control,&pkg->filekeys,force,FALSE);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
}
......
......@@ -33,7 +33,7 @@ extern int verbose;
// of only \n terminated oned. Though this has still to be tested properly...
/* Call action for each chunk in <filename> */
retvalue chunk_foreach(const char *filename,chunkaction action,void *data,int force,int stopwhenok){
retvalue chunk_foreach(const char *filename,chunkaction action,void *data,int force,bool_t stopwhenok){
gzFile f;
retvalue result,ret;
char *chunk;
......@@ -68,7 +68,7 @@ retvalue chunk_foreach(const char *filename,chunkaction action,void *data,int fo
retvalue chunk_read(gzFile f,char **chunk) {
char *buffer,*bhead,*p;
size_t size,already,without,l;
int afternewline = 0;
bool_t afternewline = FALSE;
size = 4096;
already = 0; without = 0;
......@@ -291,7 +291,7 @@ retvalue chunk_getextralinelist(const char *chunk,const char *name,struct strlis
retvalue chunk_getwholedata(const char *chunk,const char *name,char **value) {
const char *f,*p,*e;
int afternewline = 0;
bool_t afternewline = FALSE;
char *v;
f = chunk_getfield(name,chunk);
......@@ -300,13 +300,13 @@ retvalue chunk_getwholedata(const char *chunk,const char *name,char **value) {
for ( e = p = f ; *p ; p++ ) {
if( afternewline ) {
if( *p == ' ' || *p == '\t' )
afternewline = 0;
afternewline = FALSE;
else if( *p != '\r' )
break;
} else {
if( *p == '\n' ) {
e = p;
afternewline = 1;
afternewline = TRUE;
}
}
}
......@@ -384,7 +384,7 @@ retvalue chunk_checkfield(const char *chunk,const char *name){
/* Parse a package/source-field: ' *value( ?\(version\))? *',
* where pkgname consists of [-+.a-z0-9]*/
retvalue chunk_getname(const char *chunk,const char *name,
char **pkgname,int allowversion) {
char **pkgname,bool_t allowversion) {
const char *field,*name_end,*p;
field = chunk_getfield(name,chunk);
......@@ -400,7 +400,7 @@ retvalue chunk_getname(const char *chunk,const char *name,
if( name_end == field ||
( *p != '\0' && *p != '\n' &&
( !allowversion || *p != '('))) {
if( *field == '\n' || *field == 0 ) {
if( *field == '\n' || *field == '\0' ) {
fprintf(stderr,"Error: Field '%s' is empty!\n",name);
} else {
fprintf(stderr,"Error: Field '%s' contains unexpected character '%c'!\n",name,*p);
......
......@@ -21,7 +21,7 @@ retvalue chunk_getwholedata(const char *chunk,const char *name,char **value);
/* Parse a package/source-field: ' *value( ?\(version\))? *',
* where pkgname consists of [-+.a-z0-9]*/
retvalue chunk_getname(const char *chunk,const char *name,char **pkgname,int allowversion);
retvalue chunk_getname(const char *chunk,const char *name,char **pkgname,bool_t allowversion);
/* return RET_OK, if field is found, RET_NOTHING, if not (or value indicates false in future variants) */
retvalue chunk_gettruth(const char *chunk,const char *name);
......@@ -33,7 +33,7 @@ typedef retvalue chunkaction(void *data,const char *chunk);
/* Call action for each chunk in <filename>,
* until error when not <force> or until ok when <stopwhenok> */
retvalue chunk_foreach(const char *filename,chunkaction action,void *data,int force,int stopwhenok);
retvalue chunk_foreach(const char *filename,chunkaction action,void *data,int force,bool_t stopwhenok);
/* modifications of a chunk: */
struct fieldtoadd {
......
......@@ -30,7 +30,7 @@
extern int verbose;
/* create directory dirname. returns 0 on success or if already existing, -1 otherwise */
/* create directory dirname. */
static retvalue dirs_check(const char *dirname) {
int ret;
......
......@@ -293,7 +293,7 @@ retvalue distribution_foreach(const char *conf,int argc,const char *argv[],distr
if( !fn )
return RET_ERROR_OOM;
result = chunk_foreach(fn,processdistribution,&mydata,force,0);
result = chunk_foreach(fn,processdistribution,&mydata,force,FALSE);
free(fn);
return result;
......@@ -330,7 +330,7 @@ retvalue distribution_getmatched(const char *conf,int argc,const char *argv[],st
if( !fn )
return RET_ERROR_OOM;
result = chunk_foreach(fn,adddistribution,&mydata,0,0);
result = chunk_foreach(fn,adddistribution,&mydata,0,FALSE);
free(fn);
if( RET_IS_OK(result) ) {
......@@ -368,7 +368,7 @@ retvalue distribution_get(struct distribution **distribution,const char *conf,co
if( !fn )
return RET_ERROR_OOM;
result = chunk_foreach(fn,processgetdistribution,&mydata,0,1);
result = chunk_foreach(fn,processgetdistribution,&mydata,0,TRUE);
free(fn);
......@@ -380,7 +380,7 @@ retvalue distribution_get(struct distribution **distribution,const char *conf,co
retvalue distribution_export(struct distribution *distribution,
const char *dbdir, const char *distdir,
int force, int onlyneeded) {
int force, bool_t onlyneeded) {
struct target *target;
retvalue result,r;
......
......@@ -51,7 +51,7 @@ retvalue distribution_foreach_part(const struct distribution *distribution,const
struct target *distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture,const char *suffix);
retvalue distribution_export(struct distribution *distribution,const char *dbdir,const char *distdir,int force,int onlyneeded);
retvalue distribution_export(struct distribution *distribution,const char *dbdir,const char *distdir,int force,bool_t onlyneeded);
typedef retvalue distributionaction(void *data,const char *chunk,struct distribution *distribution);
......
......@@ -38,4 +38,8 @@ typedef int retvalue;
#define EXIT_RET(ret) ((ret>=0)?((nothingiserror&&ret==0)?1:0):ret)
typedef int bool_t;
#define TRUE 1
#define FALSE 0
#endif
......@@ -211,7 +211,7 @@ static retvalue files_checkmd5sum(filesdb filesdb,const char *filekey,const char
/* check for file in the database and if not found there, if it can be detected */
int files_expect(filesdb db,const char *filekey,const char *md5sum) {
retvalue files_expect(filesdb db,const char *filekey,const char *md5sum) {
retvalue ret;
int dbret;
DBT key,data;
......@@ -288,7 +288,7 @@ retvalue files_printmissing(filesdb db,const struct strlist *filekeys,const stru
}
/* dump out all information */
int files_printmd5sums(filesdb db) {
retvalue files_printmd5sums(filesdb db) {
DBC *cursor;
DBT key,data;
int dbret;
......@@ -349,7 +349,7 @@ retvalue files_foreach(filesdb db,per_file_action action,void *privdata) {
return result;
}
struct checkfiledata { filesdb filesdb ; int fast ; };
struct checkfiledata { filesdb filesdb ; bool_t fast ; };
static retvalue getfilesize(off_t *s,const char *md5sum) {
const char *p;
......@@ -428,7 +428,7 @@ static retvalue checkfile(void *data,const char *filekey,const char *md5sumexpec
return r;
}
retvalue files_checkpool(filesdb filesdb,int fast) {
retvalue files_checkpool(filesdb filesdb,bool_t fast) {
struct checkfiledata d;
d.fast = fast;
d.filesdb = filesdb;
......
......@@ -73,7 +73,7 @@ typedef retvalue per_file_action(void *data,const char *filekey,const char *md5s
retvalue files_foreach(filesdb filesdb,per_file_action action,void *data);
/* check if all files are corect. (skip md5sum if fast is true) */
retvalue files_checkpool(filesdb filesdb,int fast);
retvalue files_checkpool(filesdb filesdb,bool_t fast);
/* dump out all information */
retvalue files_printmd5sums(filesdb filesdb);
......
This diff is collapsed.
......@@ -347,7 +347,7 @@ retvalue names_checkpkgname(const char *name) {
void names_overversion(const char **version) {
const char *n = *version;
int hadepoch = 0;
bool_t hadepoch = FALSE;
if( *n < '0' || *n > '9' ) {
if( (*n < 'a' || *n > 'z') && (*n < 'A' || *n > 'Z') )
......@@ -365,7 +365,7 @@ void names_overversion(const char **version) {
while( *n >= '0' && *n <= '9' )
n++;
if( *n == ':' ) {
hadepoch = 1;
hadepoch = TRUE;
n++;
//TODO: more corectly another check should be here to also look for a digit...
}
......
......@@ -99,7 +99,7 @@ retvalue packages_initialize(packagesdb *db,const char *dbpath,const char *ident
free(pkgs);
return RET_ERROR_OOM;
}
pkgs->wasmodified = 0;
pkgs->wasmodified = FALSE;
if ((dbret = db_create(&pkgs->database, NULL, 0)) != 0) {
fprintf(stderr, "db_create: %s:%s %s\n", filename,identifier,db_strerror(dbret));
......@@ -131,7 +131,7 @@ static retvalue packages_replace(packagesdb db,const char *package,const char *c
SETDBT(key,package);
if ((dbret = db->database->del(db->database, NULL, &key, 0)) == 0) {
db->wasmodified = 1;
db->wasmodified = TRUE;
if( verbose > 2 )
printf("db: removed old '%s' from '%s'.\n", (const char *)key.data,db->identifier);
} else {
......@@ -142,7 +142,7 @@ static retvalue packages_replace(packagesdb db,const char *package,const char *c
SETDBT(key,package);
SETDBT(data,chunk);
if ((dbret = db->database->put(db->database, NULL, &key, &data, DB_NOOVERWRITE)) == 0) {
db->wasmodified = 1;
db->wasmodified = TRUE;
if( verbose > 2 )
printf("db: '%s' added to '%s'.\n", (const char *)key.data,db->identifier);
return RET_OK;
......@@ -160,7 +160,7 @@ static retvalue packages_add(packagesdb db,const char *package,const char *chunk
SETDBT(key,package);
SETDBT(data,chunk);
if ((dbret = db->database->put(db->database, NULL, &key, &data, DB_NOOVERWRITE)) == 0) {
db->wasmodified = 1;
db->wasmodified = TRUE;
if( verbose > 2 )
printf("db: '%s' added to '%s'.\n", (const char *)key.data,db->identifier);
return RET_OK;
......@@ -202,7 +202,7 @@ retvalue packages_remove(packagesdb db,const char *package) {
SETDBT(key,package);
if ((dbret = db->database->del(db->database, NULL, &key, 0)) == 0) {
db->wasmodified = 1;
db->wasmodified = TRUE;
if( verbose > 2 )
printf("db: '%s' removed from '%s'.\n", (const char *)key.data,db->identifier);
return RET_OK;
......
......@@ -20,7 +20,7 @@
typedef struct s_packagesdb {
char *identifier;
DB *database;
int wasmodified;
bool_t wasmodified;
} *packagesdb;
/* initialize the packages-database for <identifier> */
......
......@@ -24,7 +24,7 @@
#include "error.h"
#include "strlist.h"
int strlist_in(const struct strlist *strlist,const char *element) {
bool_t strlist_in(const struct strlist *strlist,const char *element) {
int c;
char **t;
......@@ -34,12 +34,12 @@ int strlist_in(const struct strlist *strlist,const char *element) {
t = strlist->values;
while( c-- != 0 ) {
if( strcmp(*(t++),element) == 0 )
return 1;
return TRUE;
}
return 0;
return FALSE;
}
int strlist_subset(const struct strlist *strlist,const struct strlist *subset) {
bool_t strlist_subset(const struct strlist *strlist,const struct strlist *subset) {
int c;
char **t;
......@@ -49,9 +49,9 @@ int strlist_subset(const struct strlist *strlist,const struct strlist *subset) {
t = subset->values;
while( c-- != 0 ) {
if( !strlist_in(strlist,*(t++)) )
return 0;
return FALSE;
}
return 1;
return TRUE;
}
......
......@@ -29,7 +29,7 @@ retvalue strlist_dup(struct strlist *dest,const struct strlist *orig);
/* replace the contents of dest with those from orig, which get emptied */
void strlist_move(struct strlist *dest,struct strlist *orig);
int strlist_in(const struct strlist *strlist,const char *element);
int strlist_subset(const struct strlist *strlist,const struct strlist *subset);
bool_t strlist_in(const struct strlist *strlist,const char *element);
bool_t strlist_subset(const struct strlist *strlist,const struct strlist *subset);
#endif
......@@ -133,7 +133,7 @@ const strtupel *strtupel_next(const strtupel *tupel) {
return p;
}
int strtupel_empty(const strtupel *tupel) {
static bool_t strtupel_empty(const strtupel *tupel) {
return (*tupel == '\0');
}
......
......@@ -46,7 +46,7 @@ static retvalue target_initialize(
const char *codename,const char *component,const char *architecture,
const char *suffix,
get_name getname,get_version getversion,get_installdata getinstalldata,
get_filekeys getfilekeys, get_upstreamindex getupstreamindex,char *directory, const char *indexfile, int unc, int hasrelease, struct target **d) {
get_filekeys getfilekeys, get_upstreamindex getupstreamindex,char *directory, const char *indexfile, bool_t uncompressed, bool_t hasrelease, struct target **d) {
struct target *t;
......@@ -61,10 +61,10 @@ static retvalue target_initialize(
}
t->directory = directory;
t->indexfile = indexfile;
if( unc ) {
t->compressions[ic_uncompressed] = 1;
if( uncompressed ) {
t->compressions[ic_uncompressed] = TRUE;
}
t->compressions[ic_gzip] = 1;
t->compressions[ic_gzip] = TRUE;
t->codename = strdup(codename);
t->component = strdup(component);
t->architecture = strdup(architecture);
......@@ -85,14 +85,14 @@ static retvalue target_initialize(
}
retvalue target_initialize_ubinary(const char *codename,const char *component,const char *architecture,struct target **target) {
return target_initialize(codename,component,architecture,"udeb",binaries_getname,binaries_getversion,binaries_getinstalldata,binaries_getfilekeys,ubinaries_getupstreamindex,mprintf("%s/%s/debian-installer/binary-%s",codename,component,architecture),"Packages",1,0,target);
return target_initialize(codename,component,architecture,"udeb",binaries_getname,binaries_getversion,binaries_getinstalldata,binaries_getfilekeys,ubinaries_getupstreamindex,mprintf("%s/%s/debian-installer/binary-%s",codename,component,architecture),"Packages",TRUE,FALSE,target);
}
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,struct target **target) {
return target_initialize(codename,component,architecture,"deb",binaries_getname,binaries_getversion,binaries_getinstalldata,binaries_getfilekeys,binaries_getupstreamindex,mprintf("%s/%s/binary-%s",codename,component,architecture),"Packages",1,1,target);
return target_initialize(codename,component,architecture,"deb",binaries_getname,binaries_getversion,binaries_getinstalldata,binaries_getfilekeys,binaries_getupstreamindex,mprintf("%s/%s/binary-%s",codename,component,architecture),"Packages",TRUE,TRUE,target);
}
retvalue target_initialize_source(const char *codename,const char *component,struct target **target) {
return target_initialize(codename,component,"source","dsc",sources_getname,sources_getversion,sources_getinstalldata,sources_getfilekeys,sources_getupstreamindex,mprintf("%s/%s/source",codename,component),"Sources",0,1,target);
return target_initialize(codename,component,"source","dsc",sources_getname,sources_getversion,sources_getinstalldata,sources_getfilekeys,sources_getupstreamindex,mprintf("%s/%s/source",codename,component),"Sources",FALSE,TRUE,target);
}
......@@ -144,7 +144,7 @@ retvalue target_closepackagesdb(struct target *target) {
} else {
if( target->packages->wasmodified && !target->wasmodified ) {
fprintf(stderr,"Internal Warning: Missed change!\n");
target->wasmodified = 1;
target->wasmodified = TRUE;
}
r = packages_done(target->packages);
target->packages = NULL;
......@@ -177,14 +177,14 @@ retvalue target_removepackage(struct target *target,DB *references,const char *n
fprintf(stderr,"removing '%s' from '%s'...\n",name,target->identifier);
r = packages_remove(target->packages,name);
if( RET_IS_OK(r) ) {
target->wasmodified = 1;
target->wasmodified = TRUE;
r = references_delete(references,target->identifier,&files,NULL);
}
strlist_done(&files);
return r;
}
retvalue target_addpackage(struct target *target,DB *references,const char *name,const char *version,const char *control,const struct strlist *filekeys,int force,int downgrade) {
retvalue target_addpackage(struct target *target,DB *references,const char *name,const char *version,const char *control,const struct strlist *filekeys,int force,bool_t downgrade) {
struct strlist oldfilekeys,*ofk;
char *oldcontrol;
retvalue r;
......@@ -243,7 +243,7 @@ retvalue target_addpackage(struct target *target,DB *references,const char *name
}
r = packages_insert(references,target->packages,name,control,filekeys,ofk);
if( RET_IS_OK(r) )
target->wasmodified = 1;
target->wasmodified = TRUE;
if( ofk )
strlist_done(ofk);
......@@ -380,7 +380,7 @@ retvalue target_check(struct target *target,filesdb filesdb,DB *referencesdb,int
}
/* export a database */
retvalue target_export(struct target *target,const char *dbdir,const char *distdir,int force,int onlyneeded) {
retvalue target_export(struct target *target,const char *dbdir,const char *distdir,int force,bool_t onlyneeded) {
indexcompression compression;
retvalue result,r,r2;
......@@ -426,8 +426,8 @@ retvalue target_export(struct target *target,const char *dbdir,const char *distd
}
if( !RET_WAS_ERROR(result) ) {
if( target->packages )
target->packages->wasmodified = 0;
target->wasmodified = 0;
target->packages->wasmodified = FALSE;
target->wasmodified = FALSE;
}
return result;
}
......
......@@ -30,15 +30,15 @@ struct target {
/* "deb" "udeb" or "dsc" */
const char *suffix;
char *directory;
int compressions[ic_max+1];
int hasrelease;
bool_t compressions[ic_max+1];
bool_t hasrelease;
const char *indexfile;
get_name *getname;
get_version *getversion;
get_installdata *getinstalldata;
get_filekeys *getfilekeys;
get_upstreamindex *getupstreamindex;
int wasmodified;
bool_t wasmodified;
/* the next one in the list of targets of a distribution */
struct target *next;
/* is initialized as soon as needed: */
......@@ -51,7 +51,7 @@ retvalue target_initialize_source(const char *codename,const char *component,str
retvalue target_free(struct target *target);
retvalue target_mkdistdir(struct target *target,const char *distdir);
retvalue target_export(struct target *target,const char *dbdir,const char *distdir,int force,int onlyneeded);
retvalue target_export(struct target *target,const char *dbdir,const char *distdir,int force,bool_t onlyneeded);
retvalue target_printmd5sums(const struct target *target,const char *distdir,FILE *out,int force);
......@@ -62,9 +62,9 @@ retvalue target_closepackagesdb(struct target *target);
/* The following calls can only be called if target_initpackagesdb was called before: */
retvalue target_addpackage(struct target *target,DB *references,const char *name,const char *version,const char *control,const struct strlist *filekeys,int force,int downgrade);
retvalue target_addpackage(struct target *target,DB *references,const char *name,const char *version,const char *control,const struct strlist *filekeys,int force,bool_t downgrade);
retvalue target_removepackage(struct target *target,DB *references,const char *name);
retvalue target_writeindices(struct target *target,const char *distdir, int force,int onlyneeded);
retvalue target_writeindices(struct target *target,const char *distdir, int force,bool_t onlyneeded);
retvalue target_check(struct target *target,filesdb filesdb,DB *referencesdb,int force);
retvalue target_rereference(struct target *target,DB *referencesdb,int force);
......
......@@ -30,24 +30,6 @@
#include "names.h"
#include "terms.h"
/*
enum term_comparison { tc_none=0, tc_equal, tc_strictlesser, tc_strictlarger,
tc_lesserorequal, tc_largerorequal };
typedef struct term_atom {
struct term_atom *next;
struct term_atom *nextiftrue,*nextiffalse;
int negated;
char *key;
enum term_comparison comparison;
char *version;
int architectures_negated;
struct strlist architectures;
char *value;
} term;
*/
void term_free(term *term) {
while( term != NULL ) {
struct term_atom *next = term->next;
......@@ -159,7 +141,7 @@ static retvalue parseatom(const char **formula,struct term_atom **atom,int optio
a = calloc(1,sizeof(struct term_atom));
if( a == NULL )
return RET_ERROR_OOM;
a->negated = 0; // not yet supported..., what char would that be?
a->negated = FALSE; // not yet supported..., what char would that be?
a->key = strndup(keystart,keyend-keystart);
if( a->key == NULL ) {
term_free(a);
......@@ -218,6 +200,7 @@ retvalue term_compile(term **term, const char *origformula, int options) {
int depth=0;
retvalue r;
int i;
//TODO: ???
int atbeginning = 1;
char junction = '\0';
......
......@@ -12,7 +12,7 @@ typedef struct term_atom {
* nextiftrue == NULL means total result is true,
* nextiffalse == NULL means total result is false. */
struct term_atom *nextiftrue,*nextiffalse;
int negated;
bool_t negated;
/* package-name or key */
char *key;
......@@ -20,7 +20,7 @@ typedef struct term_atom {
enum term_comparison comparison;
char *comparewith;
/* architecture requirements */
int architectures_negated;
bool_t architectures_negated;
struct strlist architectures;
} term;
......
......@@ -93,7 +93,7 @@ struct update_pattern {
//e.g. "Suite: woody" or "Suite: <asterix>/updates" (NULL means "*")
char *suite_from;
//e.g. "IgnoreRelease: Yes" for 1 (default is 0)
int ignorerelease;
bool_t ignorerelease;
//e.g. "ReleaseCheck: B629A24C38C6029A" (NULL means not check)
char *verifyrelease;
//e.g. "Architectures: i386 sparc mips" (empty means all)
......@@ -484,7 +484,7 @@ retvalue updates_getpatterns(const char *confdir,struct update_pattern **pattern
updatesfile = calc_dirconcat(confdir,"updates");
if( !updatesfile )
return RET_ERROR_OOM;
r = chunk_foreach(updatesfile,parsechunk,&update,force,0);
r = chunk_foreach(updatesfile,parsechunk,&update,force,FALSE);
free(updatesfile);
if( RET_IS_OK(r) )
*patterns = update;
......@@ -848,7 +848,7 @@ upgrade_decision ud_decide_by_pattern(void *privdata, const char *package,const
if( pattern->includecondition ) {
struct term_atom *atom = pattern->includecondition;
while( atom ) {
int correct;char *value;
bool_t correct;char *value;
enum term_comparison c = atom->comparison;
retvalue r;
......@@ -861,7 +861,7 @@ upgrade_decision ud_decide_by_pattern(void *privdata, const char *package,const
// fprintf(stderr,"not found %s\n",atom->key);
correct = ( c != tc_notequal );
} else if( c == tc_none) {
correct = 1;
correct = TRUE;