Commit f2fba5d2 f2fba5d2330b00c47864c516462eda9dbcce092a by Sergey Poznyakoff

(mu_registrar_lookup): Return error

code. Use an extra argument to return the flags.
(mu_0_6_registrar_lookup): New function for compatibility with
previous versions.
1 parent ea73eccd
...@@ -89,26 +89,41 @@ mu_registrar_get_iterator (mu_iterator_t *pitr) ...@@ -89,26 +89,41 @@ mu_registrar_get_iterator (mu_iterator_t *pitr)
89 } 89 }
90 90
91 int 91 int
92 mu_registrar_lookup (const char *name, mu_record_t *precord, int flags) 92 mu_registrar_lookup (const char *name, int flags,
93 mu_record_t *precord, int *pflags)
93 { 94 {
94 mu_iterator_t iterator; 95 mu_iterator_t iterator;
95 int status = mu_registrar_get_iterator (&iterator); 96 int status = mu_registrar_get_iterator (&iterator);
96 if (status != 0) 97 if (status != 0)
97 return status; 98 return status;
98 status = 0; 99 status = MU_ERR_NOENT;
99 for (mu_iterator_first (iterator); status == 0 && !mu_iterator_is_done (iterator); 100 for (mu_iterator_first (iterator); !mu_iterator_is_done (iterator);
100 mu_iterator_next (iterator)) 101 mu_iterator_next (iterator))
101 { 102 {
103 int rc;
102 mu_record_t record; 104 mu_record_t record;
103 mu_iterator_current (iterator, (void **)&record); 105 mu_iterator_current (iterator, (void **)&record);
104 status = mu_record_is_scheme (record, name, flags); 106 if ((rc = mu_record_is_scheme (record, name, flags)))
105 if (status) 107 {
106 *precord = record; 108 status = 0;
109 if (precord)
110 *precord = record;
111 if (pflags)
112 *pflags = rc;
113 }
107 } 114 }
108 mu_iterator_destroy (&iterator); 115 mu_iterator_destroy (&iterator);
109 return status; 116 return status;
110 } 117 }
111 118
119 /* For compatibility with earlier versions */
120 int
121 mu_0_6_registrar_lookup (const char *name, mu_record_t *precord, int flags)
122 {
123 int status = mu_registrar_lookup (name, flags, precord, &flags);
124 return (status == 0) ? flags : 0;
125 }
126
112 127
113 static int 128 static int
114 _compare_prio (const void *item, const void *value) 129 _compare_prio (const void *item, const void *value)
......