mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
avoid function clone
This commit is contained in:
parent
78c754cd70
commit
77ffe357a9
@ -1,8 +1,9 @@
|
||||
2002-09-22 Stefan Bellon <sbellon@sbellon.de>
|
||||
|
||||
* import.c (import_keys, import_keys_stream): Added trustdb
|
||||
update/check to key import if not fast-import and interactive
|
||||
set/no-auto-check-trustdb unset.
|
||||
* import.c (import_keys, import_keys_stream,
|
||||
import_keys_internal): Added trustdb update/check to key import if
|
||||
not fast-import and interactive set/no-auto-check-trustdb unset.
|
||||
Avoided function clone by introducing import_keys_internal.
|
||||
|
||||
2002-09-19 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
|
47
g10/import.c
47
g10/import.c
@ -173,16 +173,20 @@ import_release_stats_handle (void *p)
|
||||
* Key revocation certificates have special handling.
|
||||
*
|
||||
*/
|
||||
void
|
||||
import_keys( char **fnames, int nnames, int fast,
|
||||
static int
|
||||
import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
||||
void *stats_handle, unsigned int options )
|
||||
{
|
||||
int i;
|
||||
int i, rc = 0;
|
||||
struct stats_s *stats = stats_handle;
|
||||
|
||||
if (!stats)
|
||||
stats = import_new_stats_handle ();
|
||||
|
||||
if (inp) {
|
||||
rc = import( inp, fast, "[stream]", stats, options);
|
||||
}
|
||||
else {
|
||||
if( !fnames && !nnames )
|
||||
nnames = 1; /* Ohh what a ugly hack to jump into the loop */
|
||||
|
||||
@ -194,7 +198,7 @@ import_keys( char **fnames, int nnames, int fast,
|
||||
if( !inp )
|
||||
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
|
||||
else {
|
||||
int rc = import( inp, fast, fname, stats, options );
|
||||
rc = import( inp, fast, fname, stats, options );
|
||||
iobuf_close(inp);
|
||||
if( rc )
|
||||
log_error("import from `%s' failed: %s\n", fname,
|
||||
@ -203,6 +207,7 @@ import_keys( char **fnames, int nnames, int fast,
|
||||
if( !fname )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!stats_handle) {
|
||||
import_print_stats (stats);
|
||||
import_release_stats_handle (stats);
|
||||
@ -218,37 +223,21 @@ import_keys( char **fnames, int nnames, int fast,
|
||||
else if (!opt.no_auto_check_trustdb)
|
||||
check_trustdb();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
import_keys( char **fnames, int nnames, int fast,
|
||||
void *stats_handle, unsigned int options )
|
||||
{
|
||||
import_keys_internal( NULL, fnames, nnames, fast, stats_handle, options);
|
||||
}
|
||||
|
||||
int
|
||||
import_keys_stream( IOBUF inp, int fast,
|
||||
void *stats_handle, unsigned int options )
|
||||
{
|
||||
int rc = 0;
|
||||
struct stats_s *stats = stats_handle;
|
||||
|
||||
if (!stats)
|
||||
stats = import_new_stats_handle ();
|
||||
|
||||
rc = import( inp, fast, "[stream]", stats, options);
|
||||
if (!stats_handle) {
|
||||
import_print_stats (stats);
|
||||
import_release_stats_handle (stats);
|
||||
}
|
||||
|
||||
/* If no fast import and we really added new keys or merged new
|
||||
user ids, signatures or revocations, then update/check the
|
||||
trustdb if the user specified by setting interactive or by
|
||||
not setting no-auto-check-trustdb */
|
||||
if (!fast && (stats->imported || stats->n_uids ||
|
||||
stats->n_sigs || stats->n_revoc)) {
|
||||
if (opt.interactive)
|
||||
update_trustdb();
|
||||
else if (!opt.no_auto_check_trustdb)
|
||||
check_trustdb();
|
||||
}
|
||||
|
||||
return rc;
|
||||
return import_keys_internal( inp, NULL, NULL, fast, stats_handle, options);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user