Commit 56612cbd authored by Bernhard Link's avatar Bernhard Link

general disruptive syntax cleanup

Many disruptive cleanups in one commit to reduce any problems
generated by it.

After years of trying to apply better spacing only to new code
or changed lines, the code is a mess in that regard.

Changes:

- fix spacing issues
- new NEW, nNEW, zNEW, nzNEW macros, use FAILEDTOALLOC everywhere
- fix spacing of control statments
- cleanup IGNORING invocation
- remove argument to IGNORING__ never used anyway
- fix trailing space
- reduce the number of overlong lines
- fix tab after space issues
- get rid of transitionary _atom name suffixes
- make some header files a bit cleaner
parent 4c59eaf9
This diff is collapsed.
......@@ -13,13 +13,13 @@ struct aptmethod;
enum queue_action { qa_abort, qa_got, qa_error };
typedef retvalue queue_callback(enum queue_action, void *privdata, void *privdata2, const char *uri, const char *gotfilename, const char *wantedfilename, /*@null@*/const struct checksums *, const char *methodname);
typedef retvalue queue_callback(enum queue_action, void *, void *, const char * /*uri*/, const char * /*gotfilename*/, const char * /*wantedfilename*/, /*@null@*/const struct checksums *, const char * /*methodname*/);
retvalue aptmethod_initialize_run(/*@out@*/struct aptmethodrun **run);
retvalue aptmethod_newmethod(struct aptmethodrun *, const char *uri, const char *fallbackuri, const struct strlist *config, /*@out@*/struct aptmethod **);
retvalue aptmethod_initialize_run(/*@out@*/struct aptmethodrun **);
retvalue aptmethod_newmethod(struct aptmethodrun *, const char * /*uri*/, const char * /*fallbackuri*/, const struct strlist * /*config*/, /*@out@*/struct aptmethod **);
retvalue aptmethod_enqueue(struct aptmethod *, const char *origfile, /*@only@*/char *destfile, queue_callback *, void *, void *);
retvalue aptmethod_enqueueindex(struct aptmethod *, const char *suite, const char *origfile, const char *, const char *destfile, const char *, queue_callback *, void *, void *);
retvalue aptmethod_enqueue(struct aptmethod *, const char * /*origfile*/, /*@only@*/char */*destfile*/, queue_callback *, void *, void *);
retvalue aptmethod_enqueueindex(struct aptmethod *, const char * /*suite*/, const char * /*origfile*/, const char *, const char * /*destfile*/, const char *, queue_callback *, void *, void *);
retvalue aptmethod_download(struct aptmethodrun *);
retvalue aptmethod_shutdown(/*@only@*/struct aptmethodrun *);
......
......@@ -61,21 +61,21 @@ static ssize_t readwait(int fd, /*@out@*/void *buf, size_t count) {
totalread = 0;
while( count > 0 ) {
while (count > 0) {
ssize_t s;
s = read(fd,buf,count);
if( s < 0 )
s = read(fd, buf, count);
if (s < 0)
return s;
if( interrupted() ) {
if (interrupted()) {
errno = EINTR;
return -1;
}
if( (size_t)s > count ) {
if ((size_t)s > count) {
errno = EINVAL;
return -1;
}
if( s == 0 )
if (s == 0)
break;
totalread += s;
buf += s;
......@@ -89,13 +89,13 @@ retvalue ar_open(/*@out@*/struct ar_archive **n, const char *filename) {
char buffer[sizeof(AR_MAGIC)];
ssize_t bytesread;
if( interrupted() )
if (interrupted())
return RET_ERROR_INTERRUPTED;
ar = calloc(1,sizeof(struct ar_archive));
if( ar == NULL )
ar = zNEW(struct ar_archive);
if (FAILEDTOALLOC(ar))
return RET_ERROR_OOM;
ar->fd = open(filename,O_NOCTTY|O_RDONLY);
if( ar->fd < 0 ) {
ar->fd = open(filename, O_NOCTTY|O_RDONLY);
if (ar->fd < 0) {
int e = errno;
fprintf(stderr, "Error %d opening %s: %s\n",
e, filename, strerror(e));
......@@ -103,28 +103,31 @@ retvalue ar_open(/*@out@*/struct ar_archive **n, const char *filename) {
return RET_ERRNO(e);
}
bytesread = readwait(ar->fd,buffer,sizeof(AR_MAGIC)-1);
if( bytesread != sizeof(AR_MAGIC)-1 ) {
bytesread = readwait(ar->fd, buffer, sizeof(AR_MAGIC) - 1);
if (bytesread != sizeof(AR_MAGIC)-1) {
int e = errno;
(void)close(ar->fd);
free(ar);
if( bytesread < 0 ) {
if (bytesread < 0) {
fprintf(stderr, "Error %d reading from %s: %s\n",
e, filename, strerror(e));
return RET_ERRNO(e);
} else {
fprintf(stderr,"Premature end of reading from %s\n",filename);
fprintf(stderr, "Premature end of reading from %s\n",
filename);
return RET_ERROR;
}
}
if( memcmp(buffer,AR_MAGIC,sizeof(AR_MAGIC)-1) != 0 ) {
if (memcmp(buffer, AR_MAGIC, sizeof(AR_MAGIC)-1) != 0) {
(void)close(ar->fd);
free(ar);
fprintf(stderr, "Missing ar header '!<arch>' at the beginning of %s\n", filename);
fprintf(stderr,
"Missing ar header '!<arch>' at the beginning of %s\n",
filename);
return RET_ERROR;
}
ar->filename = strdup(filename);
if( ar->filename == NULL ) {
if (FAILEDTOALLOC(ar->filename)) {
close(ar->fd);
free(ar);
return RET_ERROR_OOM;
......@@ -136,8 +139,8 @@ retvalue ar_open(/*@out@*/struct ar_archive **n, const char *filename) {
}
void ar_close(/*@only@*/struct ar_archive *ar) {
if( ar != NULL ) {
if( ar->fd >= 0 )
if (ar != NULL) {
if (ar->fd >= 0)
(void)close(ar->fd);
free(ar->filename);
free(ar);
......@@ -145,7 +148,7 @@ void ar_close(/*@only@*/struct ar_archive *ar) {
}
/* RET_OK = next is there, RET_NOTHING = eof, < 0 = error */
retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
retvalue ar_nextmember(struct ar_archive *ar, /*@out@*/char **filename) {
ssize_t bytesread;
char *p;
off_t s;
......@@ -155,25 +158,26 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
/* seek over what is left from the last part: */
s = lseek(ar->fd, ar->next_position, SEEK_SET);
if( s == (off_t)-1 ) {
if (s == (off_t)-1) {
int e = errno;
fprintf(stderr,
"Error %d seeking to next member in ar file %s: %s\n",
"Error %d seeking to next member in ar file %s: %s\n",
e, ar->filename, strerror(e));
return RET_ERRNO(e);
}
/* read the next header from the file */
if( interrupted() )
if (interrupted())
return RET_ERROR_INTERRUPTED;
bytesread = readwait(ar->fd,&ar->currentheader,sizeof(ar->currentheader));
bytesread = readwait(ar->fd, &ar->currentheader,
sizeof(ar->currentheader));
ar->next_position += sizeof(ar->currentheader);
if( bytesread == 0 )
if (bytesread == 0)
return RET_NOTHING;
if( bytesread != sizeof(ar->currentheader) ){
if (bytesread != sizeof(ar->currentheader)){
int e = errno;
if( bytesread < 0 ) {
if (bytesread < 0) {
fprintf(stderr,
"Error %d reading from ar file %s: %s\n",
e, ar->filename, strerror(e));
......@@ -184,7 +188,7 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
return RET_ERROR;
}
}
if( memcmp(ar->currentheader.ah_magictrailer,AR_HEADERMAGIC,2) != 0 ) {
if (memcmp(ar->currentheader.ah_magictrailer, AR_HEADERMAGIC, 2) != 0) {
fprintf(stderr, "Corrupt ar file %s\n", ar->filename);
return RET_ERROR;
}
......@@ -192,33 +196,35 @@ retvalue ar_nextmember(struct ar_archive *ar,/*@out@*/char **filename) {
/* calculate the length and mark possible fillers being needed */
/* make ah_size null-terminated by overwriting the following field */
assert( &ar->currentheader.ah_magictrailer[0] == ar->currentheader.ah_size + 10 );
assert (&ar->currentheader.ah_magictrailer[0]
== ar->currentheader.ah_size + 10);
ar->currentheader.ah_magictrailer[0] = '\0';
ar->member_size = strtoul(ar->currentheader.ah_size,&p,10);
if( *p != '\0' && *p != ' ' ) {
fprintf(stderr, "Error calculating length field in ar file %s\n",
ar->member_size = strtoul(ar->currentheader.ah_size, &p, 10);
if (*p != '\0' && *p != ' ') {
fprintf(stderr,
"Error calculating length field in ar file %s\n",
ar->filename);
return RET_ERROR;
}
ar->next_position += ar->member_size;
if( (ar->member_size & 1) != 0 )
if ((ar->member_size & 1) != 0)
ar->next_position ++;
/* get the name of the file */
if( false ) {
if (false) {
/* handle long filenames */
// TODO!
} else {
/* normal filenames */
int i = sizeof(ar->currentheader.ah_filename);
while( i > 0 && ar->currentheader.ah_filename[i-1] == ' ')
while (i > 0 && ar->currentheader.ah_filename[i-1] == ' ')
i--;
/* hop over GNU style filenames, though they should not
* be in a .deb file... */
if( i > 0 && ar->currentheader.ah_filename[i-1] == '/' )
if (i > 0 && ar->currentheader.ah_filename[i-1] == '/')
i--;
*filename = strndup(ar->currentheader.ah_filename,i);
*filename = strndup(ar->currentheader.ah_filename, i);
}
ar->compression = c_none;
return RET_OK;
......@@ -232,13 +238,13 @@ ssize_t ar_archivemember_read(struct archive *a, void *d, const void **p) {
struct ar_archive *ar = d;
ssize_t bytesread;
assert( ar->readbuffer != NULL );
if( ar->member == NULL )
assert (ar->readbuffer != NULL);
if (ar->member == NULL)
return 0;
*p = ar->readbuffer;
bytesread = uncompress_read(ar->member, ar->readbuffer, BLOCKSIZE);
if( bytesread < 0 ) {
if (bytesread < 0) {
retvalue r;
const char *msg;
int e;
......@@ -257,17 +263,17 @@ int ar_archivemember_open(struct archive *a, void *d) {
const char *msg;
int e;
assert( uncompression_supported(ar->compression) );
assert (uncompression_supported(ar->compression));
assert(ar->readbuffer == NULL );
assert (ar->readbuffer == NULL);
ar->readbuffer = malloc(BLOCKSIZE);
if( ar->readbuffer == NULL ) {
if (FAILEDTOALLOC(ar->readbuffer)) {
archive_set_error(a, ENOMEM, "Out of memory");
return ARCHIVE_FATAL;
}
r = uncompress_fdopen(&ar->member, ar->fd, ar->member_size,
ar->compression, &e, &msg);
if( RET_IS_OK(r) )
if (RET_IS_OK(r))
return ARCHIVE_OK;
archive_set_error(a, e, msg);
return ARCHIVE_FATAL;
......@@ -282,12 +288,12 @@ int ar_archivemember_close(UNUSED(struct archive *a), void *d) {
free(ar->readbuffer);
ar->readbuffer = NULL;
if( ar->member == NULL )
if (ar->member == NULL)
return ARCHIVE_OK;
r = uncompress_fdclose(ar->member, &e, &msg);
ar->member = NULL;
if( RET_IS_OK(r) )
if (RET_IS_OK(r))
return ARCHIVE_OK;
archive_set_error(a, e, msg);
return ARCHIVE_FATAL;
......
......@@ -3,11 +3,11 @@
struct ar_archive;
retvalue ar_open(/*@out@*/struct ar_archive **, const char *filename);
retvalue ar_open(/*@out@*/struct ar_archive **, const char *);
void ar_close(/*@only@*/struct ar_archive *);
/* RET_OK = next is there, RET_NOTHING = eof, < 0 = error */
retvalue ar_nextmember(struct ar_archive *,/*@out@*/char **filename);
retvalue ar_nextmember(struct ar_archive *, /*@out@*/char ** /*filename*/);
/* set compression for the next member */
void ar_archivemember_setcompression(struct ar_archive *, enum compression);
......
This diff is collapsed.
#ifndef REPREPRO_ARCHALLFLOOD_H
#define REPREPRO_ARCHALLFLOOD_H
retvalue flood(struct distribution *d, /*@null@*/const struct atomlist */*components*/, /*@NULL@*/const struct atomlist */*architectures*/, /*@NULL@*/const struct atomlist */*packagetypes*/, architecture_t, struct database *, trackingdb);
retvalue flood(struct distribution *, /*@null@*/const struct atomlist * /*components*/, /*@NULL@*/const struct atomlist * /*architectures*/, /*@NULL@*/const struct atomlist * /*packagetypes*/, architecture_t, struct database *, trackingdb);
#endif
This diff is collapsed.
......@@ -39,7 +39,7 @@ packagetype_t packagetype_find_l(const char *, size_t);
atom_t atom_find(enum atom_type, const char *);
retvalue atom_intern(enum atom_type, const char *, /*@out@*/atom_t *);
#define limitation_missed(a, b) ((atom_defined(a) && (a) != (b) ))
#define limitation_missed(a, b) ((atom_defined(a) && (a) != (b)))
#define limitations_missed(a, b) ((a) != NULL && !atomlist_in(a, b))
......@@ -65,10 +65,10 @@ bool atomlist_in(const struct atomlist *, atom_t);
int atomlist_ofs(const struct atomlist *, atom_t);
/* if missing != NULL And subset no subset of atomlist, set *missing to the first missing one */
bool atomlist_subset(const struct atomlist *, const struct atomlist *subset, /*@null@*/atom_t *missing);
bool atomlist_subset(const struct atomlist *, const struct atomlist * /*subset*/, /*@null@*/atom_t * /*missing*/ );
/* print a space separated list of elements */
retvalue atomlist_fprint(FILE *, enum atom_type, const struct atomlist *);
retvalue atomlist_filllist(enum atom_type, /*@out@*/struct atomlist *, char *string, /*@out@*/const char **missing);
retvalue atomlist_filllist(enum atom_type, /*@out@*/struct atomlist *, char * /*string*/, /*@out@*/const char ** /*missing*/);
#endif
This diff is collapsed.
......@@ -28,9 +28,9 @@ complete_checksums binaries_complete_checksums;
/* Functions for checkindeb.c and incoming.c: */
struct deb_headers {
char *name,*version;
char *name, *version;
char *source;
architecture_t architecture_atom;
architecture_t architecture;
char *control;
/* only extracted when requested: */
/*@null@*/char *sourceversion;
......@@ -44,14 +44,14 @@ 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 needssourceversion);
retvalue binaries_readdeb(struct deb_headers *, const char *filename, bool /*needssourceversion*/);
void binaries_debdone(struct deb_headers *);
retvalue binaries_calcfilekeys(component_t, const struct deb_headers *, packagetype_t, /*@out@*/struct strlist *);
struct overridedata;
retvalue binaries_complete(const struct deb_headers *, const char *filekey, const struct checksums *, const struct overridedata *, const char *section, const char *priority, char **newcontrol);
retvalue binaries_complete(const struct deb_headers *, const char * /*filekey*/, const struct checksums *, const struct overridedata *, const char * /*section*/, const char * /*priority*/, char **/*newcontrol_p*/);
retvalue binaries_adddeb(const struct deb_headers *, struct database *, const struct atomlist *forcedarchitectures, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist *filekeys, const char *control);
retvalue binaries_checkadddeb(const struct deb_headers *, struct database *, architecture_t forcearchitecture, packagetype_t, struct distribution *, bool tracking, component_t, bool permitnewerold);
retvalue binaries_adddeb(const struct deb_headers *, struct database *, const struct atomlist */*forcedarchitectures*/, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist */*filekeys*/, const char */*control*/);
retvalue binaries_checkadddeb(const struct deb_headers *, struct database *, architecture_t /*forcearchitecture*/, packagetype_t, struct distribution *, bool tracking, component_t, bool /*permitnewerold*/);
#endif
......@@ -42,7 +42,7 @@ struct byhandhook {
};
void byhandhooks_free(struct byhandhook *l) {
while( l != NULL ) {
while (l != NULL) {
/*@null@*/struct byhandhook *n = l->next;
free(l->sectionglob);
......@@ -60,8 +60,10 @@ retvalue byhandhooks_parse(struct configiterator *iter, struct byhandhook **hook
struct byhandhook *h, *hooks = NULL, **nexthook_p = &hooks;
r = config_getwordinline(iter, &v);
if( RET_IS_OK(r) ) {
fprintf(stderr, "Error parsing %s, line %u, column %u: unexpected input '%s' (each hook must be in its own line)!\n",
if (RET_IS_OK(r)) {
fprintf(stderr,
"Error parsing %s, line %u, column %u: unexpected input '%s'"
" (each hook must be in its own line)!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter),
......@@ -69,16 +71,16 @@ retvalue byhandhooks_parse(struct configiterator *iter, struct byhandhook **hook
free(v);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
return r;
while( config_nextline(iter) ) {
while (config_nextline(iter)) {
r = config_getwordinline(iter, &v);
if( r == RET_NOTHING )
if (r == RET_NOTHING)
continue;
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
break;
h = calloc(1, sizeof(struct byhandhook));
if( FAILEDTOALLOC(h) ) {
h = zNEW(struct byhandhook);
if (FAILEDTOALLOC(h)) {
r = RET_ERROR_OOM;
break;
}
......@@ -86,60 +88,64 @@ retvalue byhandhooks_parse(struct configiterator *iter, struct byhandhook **hook
nexthook_p = &h->next;
h->sectionglob = v;
r = config_getwordinline(iter, &v);
if( r == RET_NOTHING ) {
fprintf(stderr, "Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 1!\n",
if (r == RET_NOTHING) {
fprintf(stderr,
"Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 1!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter));
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
break;
h->priorityglob = v;
r = config_getwordinline(iter, &v);
if( r == RET_NOTHING ) {
fprintf(stderr, "Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 2!\n",
if (r == RET_NOTHING) {
fprintf(stderr,
"Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 2!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter));
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
break;
h->filenameglob = v;
r = config_getwordinline(iter, &v);
if( r == RET_NOTHING ) {
fprintf(stderr, "Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 2!\n",
if (r == RET_NOTHING) {
fprintf(stderr,
"Error parsing %s, line %u, column %u: each byhand hooks needs 4 arguments, found only 2!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter));
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
break;
assert( v != NULL && v[0] != '\0' ); \
if( v[0] != '/' ) {
assert (v != NULL && v[0] != '\0'); \
if (v[0] != '/') {
h->script = calc_dirconcat(global.confdir, v);
free(v);
if( h->script == NULL ) {
if (FAILEDTOALLOC(h->script)) {
r = RET_ERROR_OOM;
break;
}
} else
h->script = v;
r = config_getwordinline(iter, &v);
if( RET_IS_OK(r) ) {
fprintf(stderr, "Error parsing %s, line %u, column %u: each byhand hooks needs exactly 4 arguments, but there are more (first unexpected: '%s'!\n",
if (RET_IS_OK(r)) {
fprintf(stderr,
"Error parsing %s, line %u, column %u: each byhand hooks needs exactly 4 arguments, but there are more (first unexpected: '%s'!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter), v);
free(v);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) )
if (RET_WAS_ERROR(r))
break;
}
if( RET_WAS_ERROR(r) ) {
if (RET_WAS_ERROR(r)) {
byhandhooks_free(hooks);
return r;
}
......@@ -152,15 +158,15 @@ bool byhandhooks_matched(const struct byhandhook *list, const struct byhandhook
/* for each file the first matching hook is called
* it might later be extended to allow multiple with some keywords */
if( *touse != NULL )
/* if( (*touse)->nonexclusive ) list = (*touse)->next ; else */
if (*touse != NULL)
/* if ((*touse)->nonexclusive) list = (*touse)->next ; else */
return false;
for( h = list ; h != NULL ; h = h->next ) {
if( !globmatch(section, h->sectionglob) )
for (h = list ; h != NULL ; h = h->next) {
if (!globmatch(section, h->sectionglob))
continue;
if( !globmatch(priority, h->priorityglob) )
if (!globmatch(priority, h->priorityglob))
continue;
if( !globmatch(filename, h->filenameglob) )
if (!globmatch(filename, h->filenameglob))
continue;
*touse = h;
return true;
......@@ -172,16 +178,16 @@ retvalue byhandhook_call(const struct byhandhook *h, const char *codename, const
pid_t child;
child = fork();
if( child == 0 ) {
if (child == 0) {
/* Try to close all open fd but 0,1,2 */
closefrom(3);
if( causingfile != NULL )
if (causingfile != NULL)
setenv("REPREPRO_CAUSING_FILE", causingfile, true);
else
unsetenv("REPREPRO_CAUSING_FILE");
if( atom_defined(causingcommand_atom) )
if (atom_defined(causingcommand))
setenv("REPREPRO_CAUSING_COMMAND",
atoms_commands[causingcommand_atom],
atoms_commands[causingcommand],
true);
else
unsetenv("REPREPRO_CAUSING_COMMAND");
......@@ -201,19 +207,19 @@ retvalue byhandhook_call(const struct byhandhook *h, const char *codename, const
}
_exit(255);
}
if( child < 0 ) {
if (child < 0) {
int e = errno;
fprintf(stderr, "Error %d forking: %s!\n", e, strerror(e));
return RET_ERRNO(e);
}
while( true ) {
while (true) {
int status;
pid_t pid;
pid = waitpid(child, &status, 0);
if( pid == child ) {
if( WIFEXITED(status) ) {
if( WEXITSTATUS(status) == 0) {
if (pid == child) {
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 0) {
return RET_OK;
}
fprintf(stderr,
......@@ -222,7 +228,7 @@ retvalue byhandhook_call(const struct byhandhook *h, const char *codename, const
section, priority, name,
fullfilename,
(int)(WEXITSTATUS(status)));
} else if( WIFSIGNALED(status) ) {
} else if (WIFSIGNALED(status)) {
fprintf(stderr,
"Byhandhook '%s' '%s' '%s' '%s' '%s' '%s' killed by signal %d!\n",
h->script, codename,
......@@ -237,10 +243,10 @@ retvalue byhandhook_call(const struct byhandhook *h, const char *codename, const
fullfilename);
}
return RET_ERROR;
} else if( pid == (pid_t)-1 ) {
} else if (pid == (pid_t)-1) {
int e = errno;
if( e == EINTR )
if (e == EINTR)
continue;
fprintf(stderr,
"Error %d calling waitpid on byhandhook child: %s\n",
......
......@@ -16,9 +16,9 @@ struct byhandhook;
retvalue byhandhooks_parse(struct configiterator *, /*@out@*/struct byhandhook **);
/* 2nd argument starts as NULL, returns true as long as there are hooks */
bool byhandhooks_matched(const struct byhandhook *, const struct byhandhook **, const char *section, const char *priority, const char *name);
bool byhandhooks_matched(const struct byhandhook *, const struct byhandhook **, const char * /*section*/, const char * /*priority*/, const char * /*name*/);
retvalue byhandhook_call(const struct byhandhook *, const char *codename, const char *section, const char *priority, const char *basename, const char *fullfilename);
retvalue byhandhook_call(const struct byhandhook *, const char * /*codename*/, const char * /*section*/, const char * /*priority*/, const char * /*basename*/, const char * /*fullfilename*/);
void byhandhooks_free(/*@null@*//*@only@*/struct byhandhook *);
......
......@@ -31,12 +31,12 @@
retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_type, /*@out@*/char **result_basename, /*@out@*/struct hash_data *hash_p, /*@out@*/struct hash_data *size_p, /*@out@*/char **result_section, /*@out@*/char **result_priority, /*@out@*/architecture_t *result_architecture, /*@out@*/char **result_name) {
const char *p,*md5start,*md5end;
const char *sizestart,*sizeend;
const char *sectionstart,*sectionend;
const char *priostart,*prioend;
const char *filestart,*nameend,*fileend;
const char *archstart,*archend;
const char *p, *md5start, *md5end;
const char *sizestart, *sizeend;
const char *sectionstart, *sectionend;
const char *priostart, *prioend;
const char *filestart, *nameend, *fileend;
const char *archstart, *archend;
const char *versionstart;
filetype type;
char *section, *priority, *basefilename, *name;
......@@ -45,75 +45,79 @@ retvalue changes_parsefileline(const char *fileline, /*@out@*/filetype *result_t
bool checkfilename = false;
p = fileline;
while( *p !='\0' && xisspace(*p) )
while (*p !='\0' && xisspace(*p))
p++;
md5start = p;
while( (*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f') )
while ((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f'))
p++;
if( *p == '\0' ) {
fprintf(stderr,"Missing md5sum in '%s'!\n", fileline);
if (*p == '\0') {
fprintf(stderr, "Missing md5sum in '%s'!\n", fileline);
return RET_ERROR;
}
if( !xisspace(*p) ) {
fprintf(stderr,"Malformed md5 hash in '%s'!\n", fileline);
if (!xisspace(*p)) {
fprintf(stderr, "Malformed md5 hash in '%s'!\n", fileline);
return RET_ERROR;
}
md5end = p;
while( *p !='\0' && xisspace(*p) )
while (*p !='\0' && xisspace(*p))
p++;
while( *p == '0' && p[1] >= '0' && p[1] <= '9' )
while (*p == '0' && p[1] >= '0' && p[1] <= '9')
p++;
sizestart = p;
while( *p >= '0' && *p <= '9' )
while (*p >= '0' && *p <= '9')
p++;
if( *p == '\0' ) {
fprintf(stderr,"Missing size (second argument) in '%s'!\n", fileline);
if (*p == '\0') {
fprintf(stderr,
"Missing size (second argument) in '%s'!\n", fileline);
return RET_ERROR;
}
if( !xisspace(*p) ) {
fprintf(stderr,"Malformed size (second argument) in '%s'!\n", fileline);
if (!xisspace(*p)) {
fprintf(stderr,
"Malformed size (second argument) in '%s'!\n", fileline);
return RET_ERROR;
}
sizeend = p;
while( *p !='\0' && xisspace(*p) )
while (*p !='\0' && xisspace(*p))
p++;