diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-10-06 19:07:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:17 -0500 |
commit | e918cf3abfa14d85cc21bb66d00b9e7cbb0d0626 (patch) | |
tree | 3bbdbbd750411520e335918f7bd129869b63e85f | |
parent | 9315bcd1e376241bdbe97a0d0dd569ecc5869ab4 (diff) | |
download | samba-e918cf3abfa14d85cc21bb66d00b9e7cbb0d0626.tar.gz samba-e918cf3abfa14d85cc21bb66d00b9e7cbb0d0626.tar.bz2 samba-e918cf3abfa14d85cc21bb66d00b9e7cbb0d0626.zip |
r19154: Trivial logic simplification: Get rid of two indentation levels. Survives the
consistency checks just checked into Samba4.
Volker
(This used to be commit c48bb4b37b32fac9d01d243290532641d3701ec7)
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 8d9ba7cb90..32cd5766af 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -4346,30 +4346,41 @@ static WERROR enum_all_printers_info_1(uint32 flags, RPC_BUFFER *buffer, uint32 int i; int n_services=lp_numservices(); PRINTER_INFO_1 *printers=NULL; - PRINTER_INFO_1 current_prt; WERROR result = WERR_OK; DEBUG(4,("enum_all_printers_info_1\n")); for (snum=0; snum<n_services; snum++) { - if (lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) { - struct share_params params; - params.service = snum; + PRINTER_INFO_1 current_prt; + struct share_params params; + params.service = snum; - DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); + if (!lp_browseable(snum) || !lp_snum_ok(snum) || + !lp_print_ok(snum) ) { + continue; + } - if (construct_printer_info_1(NULL, flags, ¤t_prt, ¶ms)) { - if((printers=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_1, *returned +1)) == NULL) { - DEBUG(2,("enum_all_printers_info_1: failed to enlarge printers buffer!\n")); - *returned=0; - return WERR_NOMEM; - } - DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", *returned)); + DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", + lp_servicename(snum), snum)); - memcpy(&printers[*returned], ¤t_prt, sizeof(PRINTER_INFO_1)); - (*returned)++; - } + if (!construct_printer_info_1(NULL, flags, ¤t_prt, + ¶ms)) { + continue; } + + if((printers=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_1, + *returned +1)) == NULL) { + DEBUG(2,("enum_all_printers_info_1: failed to enlarge " + "printers buffer!\n")); + *returned=0; + return WERR_NOMEM; + } + DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", + *returned)); + + memcpy(&printers[*returned], ¤t_prt, + sizeof(PRINTER_INFO_1)); + (*returned)++; } /* check the required size. */ @@ -4535,31 +4546,39 @@ static WERROR enum_all_printers_info_2(RPC_BUFFER *buffer, uint32 offered, uint3 int i; int n_services=lp_numservices(); PRINTER_INFO_2 *printers=NULL; - PRINTER_INFO_2 current_prt; WERROR result = WERR_OK; *returned = 0; for (snum=0; snum<n_services; snum++) { - if (lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) { - struct share_params params; - params.service = snum; - DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", lp_servicename(snum), snum)); - - if (construct_printer_info_2(NULL, ¤t_prt, ¶ms)) { - if ( !(printers=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_2, *returned +1)) ) { - DEBUG(2,("enum_all_printers_info_2: failed to enlarge printers buffer!\n")); - *returned = 0; - return WERR_NOMEM; - } + PRINTER_INFO_2 current_prt; + struct share_params params; + params.service = snum; + if (!lp_browseable(snum) || !lp_snum_ok(snum) || + !lp_print_ok(snum) ) { + continue; + } + DEBUG(4,("Found a printer in smb.conf: %s[%x]\n", + lp_servicename(snum), snum)); - DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *returned + 1)); + if (!construct_printer_info_2(NULL, ¤t_prt, + ¶ms)) { + continue; + } + if ( !(printers=SMB_REALLOC_ARRAY(printers, PRINTER_INFO_2, + *returned +1)) ) { + DEBUG(2,("enum_all_printers_info_2: failed to enlarge " + "printers buffer!\n")); + *returned = 0; + return WERR_NOMEM; + } - memcpy(&printers[*returned], ¤t_prt, sizeof(PRINTER_INFO_2)); + DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", + *returned + 1)); - (*returned)++; - } - } + memcpy(&printers[*returned], ¤t_prt, + sizeof(PRINTER_INFO_2)); + (*returned)++; } /* check the required size. */ |