"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: gotweb.c: Remove unused variable
To:
Martin Vahlensieck <openbsd@academicsolutions.ch>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 8 Nov 2020 08:51:26 -0700

Download raw body.

Thread
On Sat, Nov 07, 2020 at 06:52:27PM +0100, Martin Vahlensieck wrote:
> Hi
> 
> Commit f71c0a3a2e69723014f769673f7954114b01d36e changed the way gw_conf
> is allocated, since then gw_malloc is not needed anymore.
> 
> Best,
> 
> Martin
> 

Thanks! I'll take a look at your two patches this coming week.

> diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
> index 9dedeb9d..1c534e62 100644
> --- a/gotweb/gotweb.c
> +++ b/gotweb/gotweb.c
> @@ -4679,7 +4679,6 @@ main(int argc, char *argv[])
>  	struct gw_trans *gw_trans;
>  	struct gw_dir *dir = NULL, *tdir;
>  	const char *page = "index";
> -	int gw_malloc = 1;
>  	enum kcgi_err kerr = KCGI_OK;
>  
>  	if ((gw_trans = malloc(sizeof(struct gw_trans))) == NULL)
> @@ -4732,33 +4731,30 @@ main(int argc, char *argv[])
>  	else
>  		error = gw_display_index(gw_trans);
>  done:
> -	if (gw_malloc) {
> -		free(gw_trans->gw_conf->got_repos_path);
> -		free(gw_trans->gw_conf->got_www_path);
> -		free(gw_trans->gw_conf->got_site_name);
> -		free(gw_trans->gw_conf->got_site_owner);
> -		free(gw_trans->gw_conf->got_site_link);
> -		free(gw_trans->gw_conf->got_logo);
> -		free(gw_trans->gw_conf->got_logo_url);
> -		free(gw_trans->gw_conf);
> -		free(gw_trans->commit_id);
> -		free(gw_trans->next_id);
> -		free(gw_trans->next_prev_id);
> -		free(gw_trans->prev_id);
> -		free(gw_trans->prev_prev_id);
> -		free(gw_trans->repo_path);
> -		if (gw_trans->repo)
> -			got_repo_close(gw_trans->repo);
> -
> -		TAILQ_FOREACH_SAFE(dir, &gw_trans->gw_dirs, entry, tdir) {
> -			free(dir->name);
> -			free(dir->description);
> -			free(dir->age);
> -			free(dir->url);
> -			free(dir->path);
> -			free(dir);
> -		}
> -
> +	free(gw_trans->gw_conf->got_repos_path);
> +	free(gw_trans->gw_conf->got_www_path);
> +	free(gw_trans->gw_conf->got_site_name);
> +	free(gw_trans->gw_conf->got_site_owner);
> +	free(gw_trans->gw_conf->got_site_link);
> +	free(gw_trans->gw_conf->got_logo);
> +	free(gw_trans->gw_conf->got_logo_url);
> +	free(gw_trans->gw_conf);
> +	free(gw_trans->commit_id);
> +	free(gw_trans->next_id);
> +	free(gw_trans->next_prev_id);
> +	free(gw_trans->prev_id);
> +	free(gw_trans->prev_prev_id);
> +	free(gw_trans->repo_path);
> +	if (gw_trans->repo)
> +		got_repo_close(gw_trans->repo);
> +
> +	TAILQ_FOREACH_SAFE(dir, &gw_trans->gw_dirs, entry, tdir) {
> +		free(dir->name);
> +		free(dir->description);
> +		free(dir->age);
> +		free(dir->url);
> +		free(dir->path);
> +		free(dir);
>  	}
>  
>  	khttp_free(gw_trans->gw_req);

-- 

Tracey Emery