-int pq = quoter_for_address(p);
-const lookup_info * p_li = lookup_with_acq_num(pq);
-void * p_qfn = p_li ? p_li->quote : NULL;
-const lookup_info * q_li = lookup_with_acq_num(quoter);
-void * q_qfn = q_li ? q_li->quote : NULL;
-BOOL y = is_real_quoter(pq) && p_qfn == q_qfn;
+const uschar * p_name, * q_name;
+const lookup_info * p_li, * q_li;
+void * p_qfn, * q_qfn;
+
+(void) quoter_for_address(p, &p_name);
+(void) pool_for_quoter(quoter, &q_name);
+
+if (!p_name || !q_name) return FALSE;
+
+p_li = search_findtype(p_name, Ustrlen(p_name));
+p_qfn = p_li ? p_li->quote : NULL;
+q_li = search_findtype(q_name, Ustrlen(q_name));
+q_qfn = q_li ? q_li->quote : NULL;
+
+BOOL y = p_qfn == q_qfn;
+