summaryrefslogtreecommitdiff
path: root/source3/printing/nt_printing.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing/nt_printing.c')
-rw-r--r--source3/printing/nt_printing.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 40a727d853..0519e29775 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3851,39 +3851,36 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int bu
/****************************************************************************
***************************************************************************/
-static char *last_from;
-static char *last_to;
+static char *win_driver;
+static char *os2_driver;
-static const char *get_last_from(void)
+static const char *get_win_driver(void)
{
- if (!last_from) {
+ if (win_driver == NULL) {
return "";
}
- return last_from;
+ return win_driver;
}
-static const char *get_last_to(void)
+static const char *get_os2_driver(void)
{
- if (!last_to) {
+ if (os2_driver == NULL) {
return "";
}
- return last_to;
+ return os2_driver;
}
-static bool set_last_from_to(const char *from, const char *to)
+static bool set_driver_mapping(const char *from, const char *to)
{
- char *orig_from = last_from;
- char *orig_to = last_to;
+ SAFE_FREE(win_driver);
+ SAFE_FREE(os2_driver);
- last_from = SMB_STRDUP(from);
- last_to = SMB_STRDUP(to);
+ win_driver = SMB_STRDUP(from);
+ os2_driver = SMB_STRDUP(to);
- SAFE_FREE(orig_from);
- SAFE_FREE(orig_to);
-
- if (!last_from || !last_to) {
- SAFE_FREE(last_from);
- SAFE_FREE(last_to);
+ if (win_driver == NULL || os2_driver == NULL) {
+ SAFE_FREE(win_driver);
+ SAFE_FREE(os2_driver);
return false;
}
return true;
@@ -3902,10 +3899,10 @@ static void map_to_os2_driver(fstring drivername)
if (!*mapfile)
return;
- if (strequal(drivername,get_last_from())) {
+ if (strequal(drivername, get_win_driver())) {
DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",
- drivername,get_last_to()));
- fstrcpy(drivername,get_last_to());
+ drivername, get_os2_driver()));
+ fstrcpy(drivername, get_os2_driver());
return;
}
@@ -3954,7 +3951,7 @@ static void map_to_os2_driver(fstring drivername)
if (strequal(nt_name,drivername)) {
DEBUG(3,("Mapped windows driver %s to os2 driver%s\n",drivername,os2_name));
- set_last_from_to(drivername,os2_name);
+ set_driver_mapping(drivername,os2_name);
fstrcpy(drivername,os2_name);
TALLOC_FREE(lines);
return;