diff modules/ldap/eldap.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents d1247f3cc363 4aebb0131297
children a9c41067dd88
line wrap: on
line diff
--- a/modules/ldap/eldap.c	Wed Jan 20 07:05:57 2010 -0600
+++ b/modules/ldap/eldap.c	Wed Feb 24 01:58:04 2010 -0600
@@ -1,6 +1,6 @@
 /* LDAP client interface for XEmacs.
    Copyright (C) 1998 Free Software Foundation, Inc.
-   Copyright (C) 2004, 2005 Ben Wing.
+   Copyright (C) 2004, 2005, 2010 Ben Wing.
    
 
 This file is part of XEmacs.
@@ -99,7 +99,7 @@
 #endif
     }
   invalid_operation ("LDAP error",
-		     build_ext_string (ldap_err2string (ldap_err), Qnative));
+		     build_extstring (ldap_err2string (ldap_err), Qnative));
 }
 
 
@@ -134,7 +134,7 @@
 
   write_fmt_string_lisp (printcharfun, "#<ldap %S", 1, ldap->host);
   if (!ldap->ld)
-    write_c_string (printcharfun,"(dead) ");
+    write_ascstring (printcharfun,"(dead) ");
   write_fmt_string (printcharfun, " 0x%lx>", (long)ldap);
 }
 
@@ -149,14 +149,10 @@
 }
 
 static void
-finalize_ldap (void *header, int for_disksave)
+finalize_ldap (void *header)
 {
   Lisp_LDAP *ldap = (Lisp_LDAP *) header;
 
-  if (for_disksave)
-    invalid_operation ("Can't dump an emacs containing LDAP objects",
-			 make_ldap (ldap));
-
   if (ldap->ld)
     ldap_unbind (ldap->ld);
   ldap->ld = NULL;
@@ -263,13 +259,13 @@
 	else if (EQ (keyword, Qbinddn))
 	  {
 	    CHECK_STRING (value);
-	    LISP_STRING_TO_EXTERNAL (value, ldap_binddn, Qnative);
+	    ldap_binddn = LISP_STRING_TO_EXTERNAL (value, Qnative);
 	  }
 	/* Password */
 	else if (EQ (keyword, Qpasswd))
 	  {
 	    CHECK_STRING (value);
-	    LISP_STRING_TO_EXTERNAL (value, ldap_password, Qnative);
+	    ldap_password = LISP_STRING_TO_EXTERNAL (value, Qnative);
 	  }
 	/* Deref */
 	else if (EQ (keyword, Qderef))
@@ -307,7 +303,7 @@
 
   /* Connect to the server and bind */
   slow_down_interrupts ();
-  ld = ldap_open (NEW_LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port);
+  ld = ldap_open (LISP_STRING_TO_EXTERNAL (host, Qnative), ldap_port);
   speed_up_interrupts ();
 
   if (ld == NULL )
@@ -346,7 +342,7 @@
   if (err != LDAP_SUCCESS)
     {
       signal_error (Qprocess_error, "Failed binding to the server",
-		    build_ext_string (ldap_err2string (err), Qnative));
+		    build_extstring (ldap_err2string (err), Qnative));
     }
 
   ldap = allocate_ldap ();
@@ -486,7 +482,7 @@
 	EXTERNAL_LIST_LOOP_2 (current, attrs)
 	  {
 	    CHECK_STRING (current);
-	    LISP_STRING_TO_EXTERNAL (current, ldap_attributes[i], Qnative);
+	    ldap_attributes[i] = LISP_STRING_TO_EXTERNAL (current, Qnative);
 	    ++i;
 	  }
       }
@@ -498,9 +494,9 @@
 
   /* Perform the search */
   bs = NILP (base) ? (Extbyte *) "" :
-    NEW_LISP_STRING_TO_EXTERNAL (base, Qnative);
+    LISP_STRING_TO_EXTERNAL (base, Qnative);
   filt = NILP (filter) ? (Extbyte *) "" :
-    NEW_LISP_STRING_TO_EXTERNAL (filter, Qnative);
+    LISP_STRING_TO_EXTERNAL (filter, Qnative);
   if (ldap_search (ld, bs, ldap_scope, filt, ldap_attributes,
 		   NILP (attrsonly) ? 0 : 1)
       == -1)
@@ -535,19 +531,19 @@
           dn = ldap_get_dn (ld, e);
           if (dn == NULL)
             signal_ldap_error (ld, e, 0);
-          entry = Fcons (build_ext_string (dn, Qnative), Qnil);
+          entry = Fcons (build_extstring (dn, Qnative), Qnil);
         }
       for (a = ldap_first_attribute (ld, e, &ptr);
            a != NULL;
            a = ldap_next_attribute (ld, e, ptr))
         {
-          list = Fcons (build_ext_string (a, Qnative), Qnil);
+          list = Fcons (build_extstring (a, Qnative), Qnil);
           unwind.vals = ldap_get_values_len (ld, e, a);
           if (unwind.vals != NULL)
             {
               for (i = 0; unwind.vals[i] != NULL; i++)
                 {
-                  list = Fcons (make_ext_string ((Extbyte *) unwind.vals[i]->bv_val,
+                  list = Fcons (make_extstring ((Extbyte *) unwind.vals[i]->bv_val,
                                                  unwind.vals[i]->bv_len,
                                                  Qnative),
                                 list);
@@ -645,8 +641,8 @@
 	CHECK_CONS (current);
 	CHECK_STRING (XCAR (current));
 	ldap_mods_ptrs[i] = &(ldap_mods[i]);
-	LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type,
-				 Qnative);
+	ldap_mods[i].mod_type =
+	  LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative);
 	ldap_mods[i].mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES;
 	values = XCDR (current);
 	if (CONSP (values))
@@ -687,7 +683,7 @@
       }
   }
   ldap_mods_ptrs[i] = NULL;
-  rc = ldap_add_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative),
+  rc = ldap_add_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative),
 		   ldap_mods_ptrs);
   if (rc != LDAP_SUCCESS)
     signal_ldap_error (ld, NULL, rc);
@@ -754,8 +750,8 @@
 	  invalid_constant ("Invalid LDAP modification type", mod_op);
 	current = XCDR (current);
 	CHECK_STRING (XCAR (current));
-	LISP_STRING_TO_EXTERNAL (XCAR (current), ldap_mods[i].mod_type,
-				 Qnative);
+	ldap_mods[i].mod_type =
+	  LISP_STRING_TO_EXTERNAL (XCAR (current), Qnative);
 	values = XCDR (current);
 	len = (Elemcount) XINT (Flength (values));
 	bervals = alloca_array (struct berval, len);
@@ -779,7 +775,7 @@
       }
   }
   ldap_mods_ptrs[i] = NULL;
-  rc = ldap_modify_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative),
+  rc = ldap_modify_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative),
 		      ldap_mods_ptrs);
   if (rc != LDAP_SUCCESS)
     signal_ldap_error (ld, NULL, rc);
@@ -804,7 +800,7 @@
   ld = XLDAP (ldap)->ld;
   CHECK_STRING (dn);
 
-  rc = ldap_delete_s (ld, NEW_LISP_STRING_TO_EXTERNAL (dn, Qnative));
+  rc = ldap_delete_s (ld, LISP_STRING_TO_EXTERNAL (dn, Qnative));
   if (rc != LDAP_SUCCESS)
     signal_ldap_error (ld, NULL, rc);