Commit 1e533c79 authored by Bernhard Link's avatar Bernhard Link

add some splint annotations

parent 36113c5d
......@@ -170,7 +170,7 @@ static inline retvalue calcnewcontrol(const char *chunk,const char *sourcename,c
return RET_OK;
}
retvalue binaries_getname(struct target *t UNUSED,const char *control,char **packagename){
retvalue binaries_getname(UNUSED(struct target *t),const char *control,char **packagename){
retvalue r;
r = chunk_getvalue(control,"Package",packagename);
......@@ -182,7 +182,7 @@ retvalue binaries_getname(struct target *t UNUSED,const char *control,char **pac
}
return r;
}
retvalue binaries_getversion(struct target *t UNUSED,const char *control,char **version) {
retvalue binaries_getversion(UNUSED(struct target *t),const char *control,char **version) {
retvalue r;
r = chunk_getvalue(control,"Version",version);
......@@ -229,7 +229,7 @@ retvalue binaries_getinstalldata(struct target *t,const char *packagename,const
return r;
}
retvalue binaries_getfilekeys(struct target *t UNUSED,const char *chunk,struct strlist *filekeys,struct strlist *md5sums) {
retvalue binaries_getfilekeys(UNUSED(struct target *t),const char *chunk,struct strlist *filekeys,struct strlist *md5sums) {
retvalue r;
r = binaries_parse_getfilekeys(chunk,filekeys);
if( RET_WAS_ERROR(r) )
......@@ -239,11 +239,11 @@ retvalue binaries_getfilekeys(struct target *t UNUSED,const char *chunk,struct s
r = binaries_parse_md5sum(chunk,md5sums);
return r;
}
char *binaries_getupstreamindex(struct target *target UNUSED,const char *suite_from,
char *binaries_getupstreamindex(UNUSED(struct target *target),const char *suite_from,
const char *component_from,const char *architecture) {
return mprintf("dists/%s/%s/binary-%s/Packages.gz",suite_from,component_from,architecture);
}
char *ubinaries_getupstreamindex(struct target *target UNUSED,const char *suite_from,
char *ubinaries_getupstreamindex(UNUSED(struct target *target),const char *suite_from,
const char *component_from,const char *architecture) {
return mprintf("dists/%s/%s/debian-installer/binary-%s/Packages.gz",suite_from,component_from,architecture);
}
......@@ -16,7 +16,7 @@
* if forcecomponent, forcesection or forcepriority is NULL
* get it from the files or try to guess it.
* if dereferencedfilekeys is != NULL, add filekeys that lost reference */
retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,const char *packagetypeonly,const char *forcecomponent,const char *forcearchitecture,const char *forcesection,const char *forcepriority,struct distribution *distribution,const struct overrideinfo *srcoverride,const struct overrideinfo *binoverride,const char *changesfilename,int force,int delete,struct strlist *dereferencedfilekeys,bool_t onlysigned);
retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,/*@null@*/const char *packagetypeonly,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcearchitecture,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,struct distribution *distribution,/*@null@*/const struct overrideinfo *srcoverride,/*@null@*/const struct overrideinfo *binoverride,const char *changesfilename,int force,int delete,/*@null@*/struct strlist *dereferencedfilekeys,bool_t onlysigned);
#endif
......@@ -22,5 +22,5 @@
* package. (forcesection and forcepriority have higher priority than the
* information there),
* if dereferencedfilekeys is != NULL, add there filekeys that lost a reference */
retvalue deb_add(const char *dbdir,references refs,filesdb filesdb,const char *forcecomponent,const char *forcearchitecture,const char *forcesection,const char *forcepriority,const char *packagetype,struct distribution *distribution,const char *debfilename,const char *givenfilekey,const char *givenmd5sum,const struct overrideinfo *binoverride,int force,int delete,struct strlist *dereferencedfilekeys);
retvalue deb_add(const char *dbdir,references refs,filesdb filesdb,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcearchitecture,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,const char *packagetype,struct distribution *distribution,const char *debfilename,/*@null@*/const char *givenfilekey,/*@null@*/const char *givenmd5sum,/*@null@*/const struct overrideinfo *binoverride,int force,int delete,/*@null@*/struct strlist *dereferencedfilekeys);
#endif
......@@ -21,6 +21,6 @@
* of beeing newly calculated.
* (And all files are expected to already be in the pool),
* if dereferenced_filekeys is != NULL, add there the filekeys that lost a reference*/
retvalue dsc_add(const char *dbdir,references refs,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const char *filekey,const char *basename,const char *directory,const char *md5sum,const struct overrideinfo *srcoverride,int force,int delete,struct strlist *dereferencedfilekeys, bool_t onlysigned);
retvalue dsc_add(const char *dbdir,references refs,filesdb filesdb,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,struct distribution *distribution,const char *dscfilename,/*@null@*/const char *filekey,/*@null@*/const char *basename,/*@null@*/const char *directory,/*@null@*/const char *md5sum,/*@null@*/const struct overrideinfo *srcoverride,int force,int delete,/*@null@*/struct strlist *dereferencedfilekeys, bool_t onlysigned);
#endif
......@@ -28,11 +28,11 @@ retvalue chunk_gettruth(const char *chunk,const char *name);
retvalue chunk_checkfield(const char *chunk,const char *name);
typedef retvalue chunkaction(void *data,const char *chunk);
typedef retvalue chunkaction(/*@temp@*/void *data,/*@temp@*/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,bool_t stopwhenok);
retvalue chunk_foreach(const char *filename,chunkaction action,/*@null@*/ /*@temp@*/void *data,int force,bool_t stopwhenok);
/* modifications of a chunk: */
struct fieldtoadd {
......
......@@ -40,27 +40,22 @@ struct distribution {
};
retvalue distribution_get(struct distribution **distribution,const char *conf,const char *name);
retvalue distribution_free(struct distribution *distribution);
retvalue distribution_get(/*@out@*/struct distribution **distribution,const char *conf,const char *name);
retvalue distribution_free(/*@only@*/struct distribution *distribution);
typedef retvalue distribution_each_action(void *data, struct target *t);
/* call <action> for each part of <distribution>, if component or architecture is
* not NULL or "all", only do those parts */
retvalue distribution_foreach_part(const struct distribution *distribution,const char *component,const char *architecture,const char *packagetype,distribution_each_action action,void *data,int force);
retvalue distribution_foreach_part(const struct distribution *distribution,/*@null@*/const char *component,/*@null@*/const char *architecture,/*@null@*/const char *packagetype,distribution_each_action action,/*@null@*/void *data,int force);
struct target *distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture,const char *packagetype);
retvalue distribution_export(struct distribution *distribution,const char *dbdir,const char *distdir,int force,bool_t onlyneeded);
//typedef retvalue distributionaction(void *data,struct distribution *distribution);
/* call <action> for each distribution-chunk from <conf> fitting in the filter given in <argc,argv> */
//retvalue distribution_foreach(const char *conf,int argc,const char *argv[],distributionaction action,void *data,int force);
/* get all dists from <conf> fitting in the filter given in <argc,argv> */
retvalue distribution_getmatched(const char *conf,int argc,const char *argv[],struct distribution **distributions);
retvalue distribution_getmatched(const char *conf,int argc,const char *argv[],/*@out@*/struct distribution **distributions);
retvalue distribution_freelist(struct distribution *distributions);
retvalue distribution_exportandfreelist(struct distribution *distributions, const char *dbdir, const char *distdir, int force);
retvalue distribution_freelist(/*@only@*/struct distribution *distributions);
retvalue distribution_exportandfreelist(/*@only@*/struct distribution *distributions, const char *dbdir, const char *distdir, int force);
#endif
......@@ -42,10 +42,14 @@ typedef int bool_t;
#define TRUE (1==1)
#define FALSE (0==42)
#ifdef SPLINT
#define UNUSED(a) /*@unused@*/ a
#else
#ifndef NOUNUSEDATTRIBUTE
#define UNUSED __attribute((unused))
#define UNUSED(a) a __attribute((unused))
#else
#define UNUSED
#define UNUSED(a) a
#endif
#endif
#endif
......@@ -274,7 +274,7 @@ retvalue packages_foreach(packagesdb db,per_package_action action,void *privdata
}
static retvalue printout(void *data,const char *package UNUSED,const char *chunk) {
static retvalue printout(void *data,UNUSED(const char *package),const char *chunk) {
FILE *pf = data;
size_t l;
......@@ -289,7 +289,7 @@ static retvalue printout(void *data,const char *package UNUSED,const char *chunk
}
}
static retvalue zprintout(void *data,const char *package UNUSED,const char *chunk) {
static retvalue zprintout(void *data,UNUSED(const char *package),const char *chunk) {
gzFile pf = data;
size_t l;
......
......@@ -22,13 +22,13 @@
typedef struct s_packagesdb *packagesdb;
/* initialize the packages-database for <identifier> */
retvalue packages_initialize(packagesdb *pkgs,const char *dbpath,const char *identifier);
retvalue packages_initialize(/*@out@*/packagesdb *pkgs,const char *dbpath,const char *identifier);
/* The same but calculate the identifier */
retvalue packages_init(packagesdb *pkgs,const char *dbpath,const char *codename,const char *component,const char *architecture,const char *packagetype);
/* release the packages-database initialized got be packages_initialize */
retvalue packages_done(packagesdb db);
retvalue packages_done(/*@only@*/packagesdb db);
/* save a given chunk in the database */
//retvalue packages_add(packagesdb db,const char *package,const char *chunk);
......@@ -38,7 +38,7 @@ retvalue packages_done(packagesdb db);
retvalue packages_remove(packagesdb db,const char *package);
/* get the saved chunk from the database,
* returns RET_NOTHING, if there is none*/
retvalue packages_get(packagesdb db,const char *package,char **chunk);
retvalue packages_get(packagesdb db,const char *package,/*@out@*/char **chunk);
/* insert a chunk in the packages database, adding and deleting
* references and insert files while that.
......@@ -52,9 +52,9 @@ retvalue packages_insert(references refs, packagesdb packagesdb,
retvalue packages_export(packagesdb packagesdb,const char *filename,indexcompression compression);
/* action to be called by packages_forall */
typedef retvalue per_package_action(void *data,const char *package,const char *chunk);
typedef retvalue per_package_action(void *data,const char *package,/*@temp@*/const char *chunk);
/* call action once for each saved chunk: */
retvalue packages_foreach(packagesdb packagesdb,per_package_action action,void *data, int force);
retvalue packages_foreach(packagesdb packagesdb,per_package_action action,/*@temp@*/ /*@null@*/void *data, int force);
#endif
......@@ -236,7 +236,7 @@ retvalue sources_calcfilelines(const struct strlist *basenames,const struct strl
return RET_OK;
}
retvalue sources_getname(struct target *t UNUSED,const char *control,char **packagename){
retvalue sources_getname(UNUSED(struct target *t),const char *control,char **packagename){
retvalue r;
r = chunk_getvalue(control,"Package",packagename);
......@@ -248,7 +248,7 @@ retvalue sources_getname(struct target *t UNUSED,const char *control,char **pack
}
return r;
}
retvalue sources_getversion(struct target *t UNUSED,const char *control,char **version) {
retvalue sources_getversion(UNUSED(struct target *t),const char *control,char **version) {
retvalue r;
r = chunk_getvalue(control,"Version",version);
......@@ -261,7 +261,7 @@ retvalue sources_getversion(struct target *t UNUSED,const char *control,char **v
return r;
}
retvalue sources_getinstalldata(struct target *t,const char *packagename,const char *version UNUSED,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
retvalue sources_getinstalldata(struct target *t,const char *packagename,UNUSED(const char *version),const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
retvalue r;
char *origdirectory;
struct strlist filelines,basenames;
......@@ -304,7 +304,7 @@ retvalue sources_getinstalldata(struct target *t,const char *packagename,const c
return r;
}
retvalue sources_getfilekeys(struct target *t UNUSED,const char *chunk,struct strlist *filekeys,struct strlist *md5sums) {
retvalue sources_getfilekeys(UNUSED(struct target *t),const char *chunk,struct strlist *filekeys,struct strlist *md5sums) {
char *origdirectory;
struct strlist basenames,mymd5sums;
retvalue r;
......@@ -336,7 +336,7 @@ retvalue sources_getfilekeys(struct target *t UNUSED,const char *chunk,struct st
return r;
}
char *sources_getupstreamindex(struct target *target UNUSED,const char *suite_from,
const char *component_from,const char *architecture UNUSED) {
char *sources_getupstreamindex(UNUSED(struct target *target),const char *suite_from,
const char *component_from,UNUSED(const char *architecture)) {
return mprintf("dists/%s/%s/source/Sources.gz",suite_from,component_from);
}
......@@ -11,17 +11,17 @@ struct strlist {
int count,size;
};
retvalue strlist_init(struct strlist *strlist);
retvalue strlist_init_n(int startsize,struct strlist *strlist);
retvalue strlist_init_singleton(char *value,struct strlist *strlist);
retvalue strlist_init(/*@out@*/struct strlist *strlist);
retvalue strlist_init_n(int startsize,/*@out@*/struct strlist *strlist);
retvalue strlist_init_singleton(char *value,/*@out@*/struct strlist *strlist);
void strlist_done(struct strlist *strlist);
/* add a string, will get property of the strlist and free'd by it */
retvalue strlist_add(struct strlist *strlist,char *element);
retvalue strlist_add(struct strlist *strlist,/*@only@*/char *element);
/* include a string at the beginning, otherwise like strlist_add */
retvalue strlist_include(struct strlist *strlist,char *element);
retvalue strlist_include(struct strlist *strlist,/*@only@*/char *element);
/* add a string alphabetically, discarding if already there. */
retvalue strlist_adduniq(struct strlist *strlist,char *element);
retvalue strlist_adduniq(struct strlist *strlist,/*@only@*/char *element);
/* print a space seperated list of elements */
retvalue strlist_fprint(FILE *file,const struct strlist *strlist);
......
......@@ -14,11 +14,11 @@
struct target;
typedef retvalue get_name(struct target *,const char *,char **);
typedef retvalue get_version(struct target *,const char *,char **);
typedef retvalue get_installdata(struct target *,const char *,const char *,const char *,char **,struct strlist *,struct strlist *,struct strlist *);
typedef retvalue get_name(struct target *,const char *,/*@out@*/char **);
typedef retvalue get_version(struct target *,const char *,/*@out@*/char **);
typedef retvalue get_installdata(struct target *,const char *,const char *,const char *,/*@out@*/char **,/*@out@*/struct strlist *,/*@out@*/struct strlist *,/*@out@*/struct strlist *);
/* md5sums may be NULL */
typedef retvalue get_filekeys(struct target *,const char *,struct strlist *filekeys,struct strlist *md5sum);
typedef retvalue get_filekeys(struct target *,const char *,/*@out@*/struct strlist *filekeys,/*@out@*/struct strlist *md5sum);
typedef char *get_upstreamindex(struct target *,const char *suite_from,
const char *component_from,const char *architecture);
......@@ -63,7 +63,7 @@ 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,references refs,const char *name,const char *version,const char *control,const struct strlist *filekeys,int force,bool_t downgrade,struct strlist *dereferencedfilekeys);
retvalue target_removepackage(struct target *target,references refs,const char *name, struct strlist *dereferencedfilekeys);
retvalue target_removepackage(struct target *target,references refs,const char *name, /*@null@*/struct strlist *dereferencedfilekeys);
retvalue target_writeindices(struct target *target,const char *distdir, int force,bool_t onlyneeded);
retvalue target_check(struct target *target,filesdb filesdb,references refsdb,int force);
retvalue target_rereference(struct target *target,references refs,int force);
......
......@@ -37,7 +37,7 @@ typedef struct term_atom {
/* (!= value) is allowed */
#define T_NOTEQUAL 0x40
retvalue term_compile(term **term, const char *formula, int options);
retvalue term_compile(/*@out@*/term **term, const char *formula, int options);
void term_free(term *term);
/* decide based on a chunk, (warning: string comparisons even for architecture!)*/
......
......@@ -942,7 +942,7 @@ retvalue updates_clearlists(const char *listdir,struct distribution *distributio
}
/************************* Preparations *********************************/
static inline retvalue startuporigin(struct aptmethodrun *run,struct update_origin *origin,struct distribution *distribution UNUSED) {
static inline retvalue startuporigin(struct aptmethodrun *run,struct update_origin *origin,UNUSED(struct distribution *distribution)) {
retvalue r;
struct aptmethod *method;
......@@ -1223,7 +1223,7 @@ static retvalue updates_calllisthooks(struct distribution *distributions,int for
return result;
}
upgrade_decision ud_decide_by_pattern(void *privdata, const char *package,const char *old_version UNUSED,const char *new_version UNUSED,const char *newcontrolchunk) {
upgrade_decision ud_decide_by_pattern(void *privdata, const char *package,UNUSED(const char *old_version),UNUSED(const char *new_version),const char *newcontrolchunk) {
struct update_pattern *pattern = privdata;
retvalue r;
......
......@@ -24,7 +24,7 @@ retvalue updates_calcindices(const char *listdir,const struct update_pattern *pa
/* remove all files ${listdir}/${distribution}_* that will not be needed. */
retvalue updates_clearlists(const char *listdir,struct distribution *distributions);
retvalue updates_update(const char *dbdir,const char *methoddir,filesdb filesdb,references refs,struct distribution *distributions,int force,bool_t nolistdownload,struct strlist *dereferencedfilekeys);
retvalue updates_update(const char *dbdir,const char *methoddir,filesdb filesdb,references refs,struct distribution *distributions,int force,bool_t nolistdownload,/*@null@*/struct strlist *dereferencedfilekeys);
retvalue updates_checkupdate(const char *dbdir,const char *methoddir,struct distribution *distributions,int force,bool_t nolistdownload);
#endif
......@@ -556,6 +556,6 @@ void upgradelist_dump(struct upgradelist *upgrade){
}
/* standard answer function */
upgrade_decision ud_always(void *privdata UNUSED,const char *package UNUSED,const char *old_version UNUSED,const char *new_version UNUSED,const char *new_controlchunk UNUSED) {
upgrade_decision ud_always(UNUSED(void *privdata),UNUSED(const char *package),UNUSED(const char *old_version),UNUSED(const char *new_version),UNUSED(const char *new_controlchunk)) {
return UD_UPGRADE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment