summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-28 17:16:35 +0100
committerVolker Lendecke <vl@samba.org>2007-12-28 17:16:35 +0100
commitd826fcf6dfb0e2203a114cbd427badc0abeea559 (patch)
treed3dd1aea3ea1662ba54b190afd0762f7ff17a54b /source3/printing
parent3ba59d461665a16cf87b991a8135821208457f67 (diff)
downloadsamba-d826fcf6dfb0e2203a114cbd427badc0abeea559.tar.gz
samba-d826fcf6dfb0e2203a114cbd427badc0abeea559.tar.bz2
samba-d826fcf6dfb0e2203a114cbd427badc0abeea559.zip
Remove a global
(This used to be commit 515f6a8cff7e28b0e98136f3214ef52512cfaf37)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index fa6ed89edd..9f2c08629d 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -373,13 +373,17 @@ static struct printjob *print_job_find(const char *sharename, uint32 jobid)
/* Convert a unix jobid to a smb jobid */
-static uint32 sysjob_to_jobid_value;
+struct unixjob_traverse_state {
+ int sysjob;
+ uint32 sysjob_to_jobid_value;
+};
static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
- TDB_DATA data, void *state)
+ TDB_DATA data, void *private_data)
{
struct printjob *pjob;
- int *sysjob = (int *)state;
+ struct unixjob_traverse_state *state =
+ (struct unixjob_traverse_state *)private_data;
if (!data.dptr || data.dsize == 0)
return 0;
@@ -388,10 +392,10 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key,
if (key.dsize != sizeof(uint32))
return 0;
- if (*sysjob == pjob->sysjob) {
+ if (state->sysjob == pjob->sysjob) {
uint32 jobid = IVAL(key.dptr,0);
- sysjob_to_jobid_value = jobid;
+ state->sysjob_to_jobid_value = jobid;
return 1;
}
@@ -407,8 +411,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
{
int services = lp_numservices();
int snum;
+ struct unixjob_traverse_state state;
- sysjob_to_jobid_value = (uint32)-1;
+ state.sysjob = unix_jobid;
+ state.sysjob_to_jobid_value = (uint32)-1;
for (snum = 0; snum < services; snum++) {
struct tdb_print_db *pdb;
@@ -418,10 +424,10 @@ uint32 sysjob_to_jobid(int unix_jobid)
if (!pdb) {
continue;
}
- tdb_traverse(pdb->tdb, unixjob_traverse_fn, &unix_jobid);
+ tdb_traverse(pdb->tdb, unixjob_traverse_fn, &state);
release_print_db(pdb);
- if (sysjob_to_jobid_value != (uint32)-1)
- return sysjob_to_jobid_value;
+ if (state.sysjob_to_jobid_value != (uint32)-1)
+ return state.sysjob_to_jobid_value;
}
return (uint32)-1;
}