Commit 7906c3d0 authored by Bernhard Link's avatar Bernhard Link

move to C99's bool, false and true

parent 5f177197
......@@ -3,6 +3,7 @@
(might cause update to report error opening dir: file exists)
* new config file parser
* remove --ignore from changestool, --ignore=shortkeyid from reprepro
* move to C99's bool, false and true
2007-08-21 Bernhard R. Link <brlink@debian.org>
* ignore SIGPIPE, so that libgpgme cannot tear us apart
......
......@@ -63,7 +63,7 @@ struct aptmethod {
/*@null@*/char *command;
size_t alreadywritten,output_length;
/* true when we are already trying the fallbacks */
bool_t fallenback;
bool fallenback;
};
struct aptmethodrun {
......@@ -258,7 +258,7 @@ inline static retvalue aptmethod_startup(struct aptmethodrun *run,struct aptmeth
int r;
/* new try, new luck */
method->fallenback = FALSE;
method->fallenback = false;
/* When there is nothing to get, there is no reason to startup
* the method. */
......@@ -366,7 +366,7 @@ static inline retvalue sendconfig(struct aptmethod *method) {
size_t l;
const char *p;
char *c;
bool_t wasnewline;
bool wasnewline;
assert(method->command == NULL);
......@@ -395,16 +395,16 @@ static inline retvalue sendconfig(struct aptmethod *method) {
strcpy(c,CONF601 CONFITEM);
c += sizeof(CONF601)+sizeof(CONFITEM)-2;
wasnewline = TRUE;
wasnewline = true;
for( p = method->config; *p != '\0' ; p++ ) {
if( *p != '\n' ) {
if( !wasnewline || !xisspace(*p) )
*(c++) = *p;
wasnewline = FALSE;
wasnewline = false;
} else {
strcpy(c,CONFITEM);
c += sizeof(CONFITEM)-1;
wasnewline = TRUE;
wasnewline = true;
}
}
*(c++) = '\n';
......@@ -557,7 +557,7 @@ static retvalue requeue_failed(struct aptmethod *method){
new_len = strlen(method->fallbackbaseuri);
/* try at most once */
method->fallenback = TRUE;
method->fallenback = true;
for( todo = method->tobedone; todo != NULL ; todo = todo->next ) {
size_t l;
......@@ -908,7 +908,7 @@ static retvalue receivedata(struct aptmethod *method,struct database *database)
method->alreadyread += r;
result = RET_NOTHING;
while(TRUE) {
while(true) {
retvalue res;
r = method->alreadyread;
......
......@@ -51,7 +51,7 @@ struct ar_archive {
} currentheader;
off_t bytes_left;
void *readbuffer;
bool_t wasodd;
bool wasodd;
};
static ssize_t readwait(int fd, /*@out@*/void *buf, size_t count) {
......@@ -191,10 +191,10 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
return RET_ERROR;
}
if( (ar->bytes_left & 1) != 0 )
ar->wasodd = TRUE;
ar->wasodd = true;
/* get the name of the file */
if( FALSE ) {
if( false ) {
/* handle long filenames */
// TODO!
} else {
......
......@@ -83,7 +83,7 @@ static retvalue binaries_parse_chunk(const char *chunk,const char *packagename,c
assert(packagename!=NULL);
/* get the sourcename */
r = chunk_getname(chunk,"Source",&mysourcename,TRUE);
r = chunk_getname(chunk, "Source", &mysourcename, true);
if( r == RET_NOTHING ) {
mysourcename = strdup(packagename);
if( mysourcename == NULL )
......@@ -366,7 +366,7 @@ retvalue binaries_retrack(UNUSED(struct target *t),const char *packagename,const
return r;
}
assert( r != RET_NOTHING );
r = trackedpackage_addfilekey(tracks,pkg, filetype, filekey, TRUE,
r = trackedpackage_addfilekey(tracks, pkg, filetype, filekey, true,
database);
if( RET_WAS_ERROR(r) ) {
trackedpackage_free(pkg);
......@@ -450,7 +450,7 @@ void binaries_debdone(struct deb_headers *pkg) {
free(pkg->priority);
}
retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool_t needssourceversion) {
retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool needssourceversion) {
retvalue r;
r = extractcontrol(&deb->control,filename);
......@@ -458,7 +458,7 @@ retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool_t
return r;
/* first look for fields that should be there */
r = chunk_getname(deb->control,"Package",&deb->name,FALSE);
r = chunk_getname(deb->control, "Package", &deb->name, false);
if( r == RET_NOTHING ) {
fprintf(stderr,"Missing 'Package' field in %s!\n",filename);
r = RET_ERROR;
......@@ -481,7 +481,7 @@ retvalue binaries_readdeb(struct deb_headers *deb, const char *filename, bool_t
if( needssourceversion )
r = chunk_getnameandversion(deb->control,"Source",&deb->source,&deb->sourceversion);
else
r = chunk_getname(deb->control,"Source",&deb->source,TRUE);
r = chunk_getname(deb->control, "Source", &deb->source, true);
if( r == RET_NOTHING ) {
deb->source = strdup(deb->name);
if( deb->source == NULL )
......@@ -575,7 +575,7 @@ retvalue binaries_adddeb(const struct deb_headers *deb,struct database *database
database,
deb->name, deb->version,
control,
filekeys, FALSE,
filekeys, false,
dereferencedfilekeys,
trackingdata, ft_ARCH_BINARY);
r2 = target_closepackagesdb(t);
......@@ -596,7 +596,7 @@ retvalue binaries_adddeb(const struct deb_headers *deb,struct database *database
database,
deb->name, deb->version,
control,
filekeys, FALSE,
filekeys, false,
dereferencedfilekeys,
trackingdata, ft_ALL_BINARY);
r2 = target_closepackagesdb(t);
......@@ -618,7 +618,7 @@ retvalue binaries_adddeb(const struct deb_headers *deb,struct database *database
database,
deb->name, deb->version,
control,
filekeys, FALSE,
filekeys, false,
dereferencedfilekeys,
trackingdata, ft_ALL_BINARY);
r2 = target_closepackagesdb(t);
......@@ -631,7 +631,7 @@ retvalue binaries_adddeb(const struct deb_headers *deb,struct database *database
return result;
}
static inline retvalue checkadddeb(struct database *database,struct distribution *distribution,const char *component,const char *architecture,const char *packagetype,bool_t tracking,const struct deb_headers *deb,bool_t permitnewerold) {
static inline retvalue checkadddeb(struct database *database, struct distribution *distribution, const char *component, const char *architecture, const char *packagetype, bool tracking, const struct deb_headers *deb, bool permitnewerold) {
retvalue r;
struct target *t;
......@@ -654,7 +654,7 @@ static inline retvalue checkadddeb(struct database *database,struct distribution
return r;
}
retvalue binaries_checkadddeb(const struct deb_headers *deb,struct database *database,const char *forcearchitecture,const char *packagetype,struct distribution *distribution,bool_t tracking,const char *component,bool_t permitnewerold) {
retvalue binaries_checkadddeb(const struct deb_headers *deb, struct database *database, const char *forcearchitecture, const char *packagetype, struct distribution *distribution, bool tracking, const char *component, bool permitnewerold) {
retvalue r,result;
int i;
......
......@@ -42,7 +42,7 @@ struct deb_headers {
* error returned
* - no checks for sanity of values, left to the caller */
retvalue binaries_readdeb(struct deb_headers *, const char *filename, bool_t needssourceversion);
retvalue binaries_readdeb(struct deb_headers *, const char *filename, bool needssourceversion);
void binaries_debdone(struct deb_headers *);
retvalue binaries_calcfilekeys(const char *component,const struct deb_headers *,const char *packagetype,struct strlist *filekeys);
......@@ -51,5 +51,5 @@ struct overrideinfo;
retvalue binaries_complete(const struct deb_headers *,const char *filekey,const char *md5sum,const struct overrideinfo *,const char *section,const char *priority,char **newcontrol);
retvalue binaries_adddeb(const struct deb_headers *,struct database *,const char *forcearchitecture,const char *packagetype,struct distribution *,struct strlist *dereferencedfilekeys,struct trackingdata *,const char *component,const struct strlist *filekeys,const char *control);
retvalue binaries_checkadddeb(const struct deb_headers *,struct database *,const char *forcearchitecture,const char *packagetype,struct distribution *,bool_t tracking,const char *component,bool_t permitnewerold);
retvalue binaries_checkadddeb(const struct deb_headers *, struct database *, const char *forcearchitecture, const char *packagetype, struct distribution *, bool tracking, const char *component, bool permitnewerold);
#endif
......@@ -100,7 +100,7 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
// We cannot say where the version ends and the filename starts,
// but as the packagetypes would be valid part of the version, too,
// this check gets the broken things.
names_overversion(&p,TRUE);
names_overversion(&p, true);
if( *p != '\0' && *p != '_' ) {
fprintf(stderr,"Unexpected character '%c' in filename within '%s'!\n",*p,fileline);
return RET_ERROR;
......
......@@ -87,8 +87,8 @@ struct fileentry {
/* only set after changes_includefiles */
char *filekey;
/* was already found in the pool before */
bool_t wasalreadythere;
bool_t included;
bool wasalreadythere;
bool included;
/* set between checkpkg and includepkg */
union { struct dscpackage *dsc; struct debpackage *deb;} pkg;
};
......@@ -114,7 +114,7 @@ struct changes {
/* the directory the .changes file resides in */
char *incomingdirectory;
/* the Version: and the version in Source: differ */
bool_t isbinnmu;
bool isbinnmu;
};
static void freeentries(/*@only@*/struct fileentry *entry) {
......@@ -256,7 +256,7 @@ static retvalue changes_read(const char *filename,/*@out@*/struct changes **chan
retvalue r;
struct changes *c;
struct strlist filelines;
bool_t broken;
bool broken;
int versioncmp;
#define E(err) { \
......@@ -316,7 +316,7 @@ static retvalue changes_read(const char *filename,/*@out@*/struct changes **chan
changes_free(c);
return RET_ERROR_OOM;
}
c->isbinnmu = FALSE;
c->isbinnmu = false;
} else {
r = dpkgversions_cmp(c->sourceversion, c->changesversion,
&versioncmp);
......@@ -495,7 +495,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
int i;
struct fileentry *e;
retvalue r = RET_OK;
bool_t havedsc=FALSE, haveorig=FALSE, havetar=FALSE, havediff=FALSE;
bool havedsc = false, haveorig = false, havetar = false, havediff = false;
/* First check for each given architecture, if it has files: */
if( forcearchitecture != NULL ) {
......@@ -550,7 +550,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
fprintf(stderr,"I don't know what to do with multiple .dsc files in '%s'!\n",filename);
return RET_ERROR;
}
havedsc = TRUE;
havedsc = true;
calculatedname = calc_source_basename(changes->source,changes->sourceversion);
if( calculatedname == NULL )
return RET_ERROR_OOM;
......@@ -565,19 +565,19 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
fprintf(stderr,"I don't know what to do with multiple .diff files in '%s'!\n",filename);
return RET_ERROR;
}
havediff = TRUE;
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 = TRUE;
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 = TRUE;
havetar = true;
}
e = e->next;
......@@ -640,7 +640,7 @@ static retvalue changes_checkfiles(struct database *database,const char *filenam
return r;
/* If is was already there, remember that */
if( RET_IS_OK(r) ) {
e->wasalreadythere = TRUE;
e->wasalreadythere = true;
} else {
/* and if it needs inclusion check if there is a file */
char *fullfilename;
......@@ -680,7 +680,7 @@ static retvalue changes_includefiles(struct database *database,struct changes *c
/* do not delete, we do that later outself */
(delete>=D_MOVE)?D_COPY:delete);
if( RET_IS_OK(r) )
e->included = TRUE;
e->included = true;
if( RET_WAS_ERROR(r) )
return r;
}
......@@ -697,7 +697,7 @@ static void changes_unincludefiles(struct database *database,struct changes *cha
if( e->filekey == NULL || e->wasalreadythere || !e->included )
continue;
(void)files_deleteandremove(database, e->filekey, TRUE, FALSE);
(void)files_deleteandremove(database, e->filekey, true, false);
}
}
/* delete the files included */
......@@ -757,7 +757,7 @@ static retvalue changes_checkpkgs(struct database *database,struct distribution
"deb",
distribution, fullfilename,
e->filekey, e->md5sum,
D_INPLACE, FALSE,
D_INPLACE, false,
&changes->binaries,
changes->source, changes->sourceversion);
} else if( e->type == fe_UDEB ) {
......@@ -767,7 +767,7 @@ static retvalue changes_checkpkgs(struct database *database,struct distribution
"udeb",
distribution, fullfilename,
e->filekey, e->md5sum,
D_INPLACE, FALSE,
D_INPLACE, false,
&changes->binaries,
changes->source, changes->sourceversion);
} else if( e->type == fe_DSC ) {
......@@ -802,11 +802,11 @@ static retvalue changes_checkpkgs(struct database *database,struct distribution
return r;
}
static retvalue changes_includepkgs(struct database *database,struct distribution *distribution,struct changes *changes,/*@null@*/struct strlist *dereferencedfilekeys, /*@null@*/struct trackingdata *trackingdata,bool_t *missed_p) {
static retvalue changes_includepkgs(struct database *database, struct distribution *distribution, struct changes *changes, /*@null@*/struct strlist *dereferencedfilekeys, /*@null@*/struct trackingdata *trackingdata, bool *missed_p) {
struct fileentry *e;
retvalue result,r;
*missed_p = FALSE;
*missed_p = false;
r = distribution_prepareforwriting(distribution);
if( RET_WAS_ERROR(r) )
return r;
......@@ -827,18 +827,18 @@ static retvalue changes_includepkgs(struct database *database,struct distributio
e->architecture, "deb",
distribution, dereferencedfilekeys, trackingdata);
if( r == RET_NOTHING )
*missed_p = TRUE;
*missed_p = true;
} else if( e->type == fe_UDEB ) {
r = deb_addprepared(e->pkg.deb, database,
e->architecture, "udeb",
distribution,dereferencedfilekeys,trackingdata);
if( r == RET_NOTHING )
*missed_p = TRUE;
*missed_p = true;
} else if( e->type == fe_DSC ) {
r = dsc_addprepared(e->pkg.dsc, database,
distribution,dereferencedfilekeys,trackingdata);
if( r == RET_NOTHING )
*missed_p = TRUE;
*missed_p = true;
}
RET_UPDATE(result, r);
......@@ -852,7 +852,7 @@ static retvalue changes_includepkgs(struct database *database,struct distributio
return result;
}
static bool_t permissionssuffice(UNUSED(struct changes *changes),
static bool permissionssuffice(UNUSED(struct changes *changes),
const struct uploadpermissions *permissions) {
return permissions->allowall;
}
......@@ -865,7 +865,7 @@ retvalue changes_add(struct database *database,trackingdb const tracks,const cha
struct changes *changes;
struct trackingdata trackingdata;
char *directory;
bool_t somethingwasmissed;
bool somethingwasmissed;
r = changes_read(changesfilename,&changes,packagetypeonly,forcearchitecture);
if( RET_WAS_ERROR(r) )
......@@ -1026,7 +1026,7 @@ retvalue changes_add(struct database *database,trackingdb const tracks,const cha
}
r = trackedpackage_addfilekey(tracks, trackingdata.pkg,
ft_CHANGES, changesfilekey, FALSE,
ft_CHANGES, changesfilekey, false,
database);
RET_ENDUPDATE(result,r);
}
......
......@@ -80,7 +80,7 @@ void deb_free(/*@only@*/struct debpackage *pkg) {
}
/* read the data from a .deb, make some checks and extract some data */
static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename, bool_t needssourceversion) {
static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename, bool needssourceversion) {
retvalue r;
struct debpackage *deb;
......@@ -106,7 +106,7 @@ static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename,
return RET_OK;
}
retvalue deb_prepare(/*@out@*/struct debpackage **deb,struct database *database,const char * const forcecomponent,const char * const forcearchitecture,const char *forcesection,const char *forcepriority,const char * const packagetype,struct distribution *distribution,const char *debfilename,const char * const givenfilekey,const char * const givenmd5sum,int delete,bool_t needsourceversion,const struct strlist *allowed_binaries,const char *expectedsourcepackage,const char *expectedsourceversion){
retvalue deb_prepare(/*@out@*/struct debpackage **deb, struct database *database, const char * const forcecomponent, const char * const forcearchitecture, const char *forcesection, const char *forcepriority, const char * const packagetype, struct distribution *distribution, const char *debfilename, const char * const givenfilekey, const char * const givenmd5sum, int delete, bool needsourceversion, const struct strlist *allowed_binaries, const char *expectedsourcepackage, const char *expectedsourceversion){
retvalue r;
struct debpackage *pkg;
const struct overrideinfo *oinfo;
......
......@@ -25,6 +25,6 @@ retvalue deb_add(struct database *,/*@null@*/const char *forcecomponent,/*@null@
struct debpackage;
retvalue deb_addprepared(const struct debpackage *pkg, struct database *,const char *forcearchitecture,const char *packagetype,struct distribution *distribution,struct strlist *dereferencedfilekeys,struct trackingdata *trackingdata);
retvalue deb_hardlinkfiles(struct debpackage *deb,struct database *,const char *debfilename);
retvalue deb_prepare(/*@out@*/struct debpackage **deb,struct database *,const char * const forcecomponent,const char * const forcearchitecture,const char *forcesection,const char *forcepriority,const char * const packagetype,struct distribution *distribution,const char *debfilename,const char * const givenfilekey,const char * const givenmd5sum,int delete,bool_t needsourceversion,const struct strlist *allowed_binaries,const char *expectedsourcename,const char *expectedsourceversion);
retvalue deb_prepare(/*@out@*/struct debpackage **deb, struct database *, const char * const forcecomponent, const char * const forcearchitecture, const char *forcesection, const char *forcepriority, const char * const packagetype, struct distribution *distribution, const char *debfilename, const char * const givenfilekey, const char * const givenmd5sum, int delete, bool needsourceversion, const struct strlist *allowed_binaries, const char *expectedsourcename, const char *expectedsourceversion);
void deb_free(/*@only@*/struct debpackage *pkg);
#endif
......@@ -107,7 +107,7 @@ void dsc_free(/*@only@*/struct dscpackage *pkg) {
static retvalue dsc_read(/*@out@*/struct dscpackage **pkg, const char *filename) {
retvalue r;
struct dscpackage *dsc;
bool_t broken;
bool broken;
dsc = calloc(1,sizeof(struct dscpackage));
......@@ -334,7 +334,7 @@ retvalue dsc_addprepared(const struct dscpackage *pkg,struct database *database,
r = target_addpackage(t, distribution->logger, database,
pkg->dsc.name, pkg->dsc.version,
pkg->dsc.control, &pkg->filekeys,
FALSE, dereferencedfilekeys,
false, dereferencedfilekeys,
trackingdata, ft_SOURCE);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
......
......@@ -32,7 +32,7 @@ typedef unsigned char uchar;
/* check if the character starting where <character> points
* at is a overlong one */
static inline bool_t overlongUTF8(const char *character) {
static inline bool overlongUTF8(const char *character) {
/* This checks for overlong utf-8 characters.
* (as they might mask '.' '\0' or '/' chars).
* we assume no filesystem/ar/gpg code will parse
......@@ -46,24 +46,24 @@ static inline bool_t overlongUTF8(const char *character) {
uchar nextc = *(character+1);
if( (nextc & (uchar)0xC0 /*11000000*/ ) != (uchar)0x80 /*10000000*/ )
return FALSE;
return false;
if( (c & (uchar)0x3E /* 00111110 */ ) == (uchar)0 )
return TRUE;
return true;
if( c == (uchar)0xE0 /*11100000*/ &&
(nextc & (uchar)0x20 /*00100000*/ ) == (uchar)0)
return TRUE;
return true;
if( c == (uchar)0xF0 /*11110000*/ &&
(nextc & (uchar)0x30 /*00110000*/ ) == (uchar)0)
return TRUE;
return true;
if( c == (uchar)0xF8 /*11111000*/ &&
(nextc & (uchar)0x38 /*00111000*/ ) == (uchar)0)
return TRUE;
return true;
if( c == (uchar)0xFC /*11111100*/ &&
(nextc & (uchar)0x3C /*00111100*/ ) == (uchar)0)
return TRUE;
return true;
}
return FALSE;
return false;
}
#define REJECTLOWCHARS(s,str,descr) \
......@@ -86,7 +86,7 @@ static inline bool_t overlongUTF8(const char *character) {
/* check if this is something that can be used as directory safely */
retvalue propersourcename(const char *string) {
const char *s;
bool_t firstcharacter = TRUE;
bool firstcharacter = true;
if( string[0] == '\0' ) {
/* This is not really ignoreable, as this will lead
......@@ -124,7 +124,7 @@ retvalue propersourcename(const char *string) {
}
}
s++;
firstcharacter = FALSE;
firstcharacter = false;
}
return RET_OK;
}
......@@ -267,9 +267,9 @@ retvalue properfilenamepart(const char *string) {
retvalue properversion(const char *string) {
const char *s = string;
bool_t hadepoch = FALSE;
bool_t first = TRUE;
bool_t yetonlydigits = TRUE;
bool hadepoch = false;
bool first = true;
bool yetonlydigits = true;
if( string[0] == '\0' && !IGNORING(
"Ignoring","To ignore this",emptyfilenamepart,"A version string is empty!\n") ) {
......@@ -283,18 +283,18 @@ retvalue properversion(const char *string) {
if( verbose >= 0 )
fprintf(stderr,"Warning: Package version '%s' does not start with a digit, violating 'should'-directive in policy 5.6.11\n",string);
}
for( ; *s != '\0' ; s++,first=FALSE ) {
for( ; *s != '\0' ; s++,first=false ) {
if( (*s <= '9' || *s >= '0' ) ) {
continue;
}
if( !first && yetonlydigits && *s == ':' ) {
hadepoch = TRUE;
hadepoch = true;
continue;
}
yetonlydigits = FALSE;
yetonlydigits = false;
if( (*s >= 'A' && *s <= 'Z' ) ||
(*s >= 'a' || *s <= 'z' )) {
yetonlydigits = FALSE;
yetonlydigits = false;
continue;
}
if( first || (*s != '+' && *s != '-' &&
......@@ -335,7 +335,7 @@ retvalue properfilenames(const struct strlist *names) {
retvalue properpackagename(const char *string) {
const char *s;
bool_t firstcharacter = TRUE;
bool firstcharacter = true;
/* To be able to avoid multiple warnings,
* this should always be a subset of propersourcename */
......@@ -373,7 +373,7 @@ retvalue properpackagename(const char *string) {
}
}
s++;
firstcharacter = FALSE;
firstcharacter = false;
}
return RET_OK;
}
......
......@@ -37,7 +37,7 @@ struct chunkeditfield {
CEF_REPLACE, /+ replace if there +/
CEF_ADD /+ add if not there or replace if there +/
} action;
bool_t early; /+ add as early as possible or as late as possible +/
bool early; /+ add as early as possible or as late as possible +/
/+ the following must be 0 or NULL for CEF_DELETE +/
size_t len_all_data;
/+@null@+/const char +data; size_t len_data;
......@@ -204,7 +204,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
}
p = chunk;
while( TRUE ) {
while( true ) {
q = p;
while( *q != '\0' && *q != '\n' && *q != ':' )
q++;
......@@ -320,7 +320,7 @@ retvalue chunk_edit(const char *chunk, char **result, size_t *rlen, const struct
}
p = chunk;
/* now add all headers in between */
while( TRUE ) {
while( true ) {
q = p;
while( *q != '\0' && *q != '\n' && *q != ':' )
q++;
......
......@@ -32,7 +32,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,bool_t stopwhenok){
retvalue chunk_foreach(const char *filename, chunkaction action, void *data, bool stopwhenok){
gzFile f;
retvalue result,ret;
char *chunk;
......@@ -72,7 +72,7 @@ retvalue chunk_foreach(const char *filename,chunkaction action,void *data,bool_t
retvalue chunk_read(gzFile f,char **chunk) {
char *buffer,*bhead;
size_t size,already,without,l;
bool_t afternewline = FALSE;
bool afternewline = false;
size = 4096;
already = 0; without = 0;
......@@ -304,7 +304,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;
bool_t afternewline = FALSE;
bool afternewline = false;
char *v;
f = chunk_getfield(name,chunk);
......@@ -313,13 +313,13 @@ retvalue chunk_getwholedata(const char *chunk,const char *name,char **value) {
for ( e = p = f ; *p != '\0' ; p++ ) {
if( afternewline ) {
if( *p == ' ' || *p == '\t' )
afternewline = FALSE;
afternewline = false;
else if( *p != '\r' )
break;
} else {
if( *p == '\n' ) {
e = p;
afternewline = TRUE;
afternewline = true;
}
}
}
......@@ -444,8 +444,7 @@ retvalue chunk_checkfield(const char *chunk,const char *name){
}
/* Parse a package/source-field: ' *value( ?\(version\))? *' */
retvalue chunk_getname(const char *chunk,const char *name,
char **pkgname,bool_t allowversion) {
retvalue chunk_getname(const char *chunk, const char *name, char **pkgname, bool allowversion) {
const char *field,*name_end,*p;
field = chunk_getfield(name,chunk);
......@@ -580,7 +579,7 @@ char *chunk_replacefields(const char *chunk,const struct fieldtoadd *toadd,const
size_t size,len_beforethis;
const struct fieldtoadd *f;
retvalue result;
bool_t fieldsadded = FALSE;
bool fieldsadded = false;
assert( chunk != NULL && beforethis != NULL );
......@@ -624,7 +623,7 @@ char *chunk_replacefields(const char *chunk,const struct fieldtoadd *toadd,const
f = f->next;
}
result = RET_OK;
fieldsadded = TRUE;
fieldsadded = true;
}
/* is this one of the fields we added/will add? */
f = toadd;
......@@ -665,7 +664,7 @@ char *chunk_replacefields(const char *chunk,const struct fieldtoadd *toadd,const
if( result == RET_NOTHING ) {
fprintf(stderr,"Could not find field '%s' in chunk '%s'!!!\n",beforethis,chunk);
assert(FALSE);
assert(false);
}
return newchunk;
......
......@@ -23,7 +23,7 @@ retvalue chunk_getuniqwordlist(const char *chunk,const char *name,/*@out@*/struc
retvalue chunk_getwholedata(const char *chunk,const char *name,/*@out@*/char **value);
/* Parse a package/source-field: ' *value( ?\(version\))? *' */
retvalue chunk_getname(const char *chunk,const char *name,/*@out@*/char **pkgname,bool_t allowversion);
retvalue chunk_getname(const char *chunk, const char *name, /*@out@*/char **pkgname, bool allowversion);
retvalue chunk_getnameandversion(const char *chunk,const char *name,/*@out@*/char **pkgname,/*@out@*/char **version);
/* return RET_OK, if field is found, RET_NOTHING, if not (or value indicates false in future variants) */
......@@ -36,7 +36,7 @@ typedef retvalue chunkaction(/*@temp@*/void *data,/*@temp@*/const char *chunk);
/* Call action for each chunk in <filename>,
* until error or until ok when <stopwhenok> */
retvalue chunk_foreach(const char *filename,chunkaction action,/*@null@*/ /*@temp@*/void *data,bool_t stopwhenok);
retvalue chunk_foreach(const char *filename, chunkaction action, /*@null@*/ /*@temp@*/void *data, bool stopwhenok);
/* modifications of a chunk: */
struct fieldtoadd {
......@@ -63,6 +63,6 @@ void addfield_free(/*@only@*//*@null@*/struct fieldtoadd *f);
/*@null@*/char *chunk_replacefield(const char *chunk,const char *fieldname,const char *data);
/* check if all field names are in allowedfieldnames */
retvalue chunk_checkfields(const char *chunk,const char * const *allowedfieldnames,bool_t commentsallowed);
retvalue chunk_checkfields(const char *chunk, const char * const *allowedfieldnames, bool commentsallowed);
#endif
......@@ -19,7 +19,6 @@
#include <assert.h>
#include <limits.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -35,7 +34,7 @@ struct configiterator {
FILE *f;
unsigned int startline, line, column, markerline, markercolumn;
char *filename;
bool_t eol;
bool eol;
};
const char *config_filename(const struct configiterator *iter) {
......@@ -68,13 +67,13 @@ void config_overline(struct configiterator *iter) {
while( !iter->eol ) {
c = fgetc(iter->f);
if( c == EOF || c == '\n' )
iter->eol = TRUE;
iter->eol = true;
else
iter->column++;
}
}
bool_t config_nextline(struct configiterator *iter) {
bool config_nextline(struct configiterator *iter) {
int c;