s3-spoolss: Use better names for set_last_from_to.
authorAndreas Schneider <asn@samba.org>
Mon, 10 May 2010 13:05:46 +0000 (15:05 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 18 May 2010 13:16:55 +0000 (15:16 +0200)
Use set_driver_mapping() and get_win_driver(), get_os2_driver().

Signed-off-by: Günther Deschner <gd@samba.org>
source3/printing/nt_printing.c

index 40a727d85317fa662e9353a1e8b9ce0c535c353a..0519e29775a3f8cc9fa0c8b49f05ed92ad0f1440 100644 (file)
@@ -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;