Commit 40167b91 authored by Bernhard Link's avatar Bernhard Link

renames strlist_{new,free} to strlist_{init,done}

parent 7831688b
......@@ -260,7 +260,7 @@ retvalue chunk_getextralinelist(const char *chunk,const char *name,struct strlis
f = chunk_getfield(name,chunk);
if( !f )
return RET_NOTHING;
r = strlist_new(strlist);
r = strlist_init(strlist);
if( RET_WAS_ERROR(r) )
return r;
/* walk over the first line */
......@@ -285,12 +285,12 @@ retvalue chunk_getextralinelist(const char *chunk,const char *name,struct strlis
else
v = strdup("");
if( !v ) {
strlist_free(strlist);
strlist_done(strlist);
return RET_ERROR_OOM;
}
r = strlist_add(strlist,v);
if( !RET_IS_OK(r) ) {
strlist_free(strlist);
strlist_done(strlist);
return r;
}
if( *f == '\0' )
......@@ -308,7 +308,7 @@ retvalue chunk_getwordlist(const char *chunk,const char *name,struct strlist *st
f = chunk_getfield(name,chunk);
if( !f )
return RET_NOTHING;
r = strlist_new(strlist);
r = strlist_init(strlist);
if( RET_WAS_ERROR(r) )
return r;
while( *f != '\0' ) {
......@@ -329,12 +329,12 @@ retvalue chunk_getwordlist(const char *chunk,const char *name,struct strlist *st
f++;
v = strndup(b,f-b);
if( !v ) {
strlist_free(strlist);
strlist_done(strlist);
return RET_ERROR_OOM;
}
r = strlist_add(strlist,v);
if( !RET_IS_OK(r) ) {
strlist_free(strlist);
strlist_done(strlist);
return r;
}
}
......
......@@ -392,7 +392,7 @@ retvalue reference_source(void *data,const char *package,const char *chunk) {
}
filekey = calc_srcfilekey(dir,basefilename);
if( !filekey) {
free(dir);strlist_free(&files);free(basefilename);
free(dir);strlist_done(&files);free(basefilename);
return RET_ERROR;
}
r = references_increment(dist->refs,filekey,dist->identifier);
......@@ -401,7 +401,7 @@ retvalue reference_source(void *data,const char *package,const char *chunk) {
if( RET_WAS_ERROR(r) )
break;
}
free(dir);strlist_free(&files);
free(dir);strlist_done(&files);
return ret;
}
......
......@@ -73,7 +73,7 @@ retvalue release_checkfile(const char *releasefile,const char *nametocheck,const
realmd5andsize = NULL;
if( ! RET_IS_OK(r=md5sum_and_size(&realmd5andsize,filetocheck,0))) {
fprintf(stderr,"Error checking %s: %m\n",filetocheck);
strlist_free(&files);
strlist_done(&files);
return r;
}
......@@ -107,7 +107,7 @@ retvalue release_checkfile(const char *releasefile,const char *nametocheck,const
if( r==RET_NOTHING && verbose>=0 )
fprintf(stderr,"%s failed as missing\n",nametocheck);
free(realmd5andsize);
strlist_free(&files);
strlist_done(&files);
return r;
}
......@@ -120,8 +120,8 @@ void release_free(struct release *release) {
free(release->origin);
free(release->label);
free(release->description);
strlist_free(&release->architectures);
strlist_free(&release->components);
strlist_done(&release->architectures);
strlist_done(&release->components);
free(release);
}
}
......
......@@ -185,7 +185,7 @@ static retvalue addsource(void *data,const char *chunk) {
if( oldchunk && (isnewer=sources_isnewer(chunk,oldchunk)) != 0 ) {
if( isnewer < 0 ) {
fprintf(stderr,"Omitting %s because of parse errors.\n",package);
free(package);strlist_free(&files);
free(package);strlist_done(&files);
free(olddirectory);
free(oldchunk);
return RET_ERROR;
......@@ -204,7 +204,7 @@ static retvalue addsource(void *data,const char *chunk) {
}
free(oldchunk);
free(package);strlist_free(&files);
free(package);strlist_done(&files);
free(olddirectory);
return r;
......@@ -253,7 +253,7 @@ retvalue sources_dereference(DB *refs,const char *referee,const char *chunk) {
free(filename);free(filekey);
}
free(directory);strlist_free(&files);
free(directory);strlist_done(&files);
return result;
}
......@@ -39,7 +39,7 @@ int strlist_in(const struct strlist *strlist,const char *element) {
return 0;
}
retvalue strlist_new(struct strlist *strlist) {
retvalue strlist_init(struct strlist *strlist) {
assert(strlist != NULL);
strlist->count = 0;
......@@ -49,7 +49,7 @@ retvalue strlist_new(struct strlist *strlist) {
return RET_OK;
}
void strlist_free(struct strlist *strlist) {
void strlist_done(struct strlist *strlist) {
int c;
char **t;
......@@ -115,7 +115,7 @@ retvalue strlist_dup(struct strlist *dest,const struct strlist *orig) {
return RET_ERROR_OOM;
for( i = 0 ; i < dest->count ; i++ ) {
if( !(dest->values[i] = strdup(orig->values[i])) ) {
strlist_free(dest);
strlist_done(dest);
return RET_ERROR_OOM;
}
}
......
......@@ -11,8 +11,8 @@ struct strlist {
int count,size;
};
retvalue strlist_new(struct strlist *strlist);
void strlist_free(struct strlist *strlist);
retvalue strlist_init(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);
......
......@@ -104,8 +104,8 @@ static retvalue processupdates(void *data,const char *chunk) {
components_need_free = 0;
}
if( !RET_WAS_ERROR(r) ) {
strlist_new(&update.components_from);
strlist_new(&update.components_into);
strlist_init(&update.components_from);
strlist_init(&update.components_into);
/* * Iterator over components to update * */
r = RET_NOTHING;
......@@ -134,12 +134,12 @@ static retvalue processupdates(void *data,const char *chunk) {
if( !RET_WAS_ERROR(r) )
r = d->action(d->data,chunk,d->release,&update);
strlist_free(&update.components_from);
strlist_free(&update.components_into);
strlist_done(&update.components_from);
strlist_done(&update.components_into);
if( components_need_free )
strlist_free(&componentlist);
strlist_done(&componentlist);
}
strlist_free(&update.architectures);
strlist_done(&update.architectures);
}
free(update.suite_from);
}
......@@ -166,7 +166,7 @@ static retvalue doupdate(void *data,const char *chunk,const struct release *rele
r = chunk_foreach(d->updatesfile,processupdates,d,d->force);
strlist_free(&d->upstreams);
strlist_done(&d->upstreams);
return r;
}
......
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