Lines Matching refs:sh
101 suri_err_check_null_warnings(struct suri_handle *sh)
104 for (i = 0; i < UU_NELEM(sh->sh_warnings); ++i) {
105 if (sh->sh_warn[i] != NULL || sh->sh_warnings[i][0] != '\0')
115 suri_err_clear_warnings(struct suri_handle *sh)
117 (void) memset(sh->sh_warn, '\0', sizeof (sh->sh_warn));
118 (void) memset(sh->sh_warnings, '\0', sizeof (sh->sh_warnings));
125 suri_err_check_null_errors(struct suri_handle *sh)
127 if (sh->sh_err_desc[0] != '\0' ||
128 sh->sh_err_static_desc != NULL ||
129 sh->sh_err_action[0] != '\0' ||
130 sh->sh_err_code != ESURI_OK) {
143 struct suri_handle *sh = (struct suri_handle *)h;
144 return (sh->sh_err_code);
153 struct suri_handle *sh = (struct suri_handle *)h;
159 assert(sh->sh_err_action[0] != '\0');
160 assert(suri_err_code((suri_handle_t)sh) != ESURI_OK);
162 assert(suri_err_check_null_warnings(sh));
163 return (sh->sh_err_action);
172 struct suri_handle *sh = (struct suri_handle *)h;
178 assert(sh->sh_err_desc[0] != '\0' || sh->sh_err_static_desc != NULL);
179 assert(suri_err_code((suri_handle_t)sh) != ESURI_OK);
180 if (sh->sh_err_static_desc != NULL)
181 return (sh->sh_err_static_desc);
182 return (sh->sh_err_desc);
191 struct suri_handle *sh = (struct suri_handle *)h;
193 if (sh->sh_warn[0] == NULL)
195 return (sh->sh_warn);
203 suri_err_set_action(struct suri_handle *sh, const char *fmt, ...)
209 assert(sh->sh_err_action[0] == '\0');
214 assert(sh->sh_err_desc[0] != '\0' || sh->sh_err_static_desc != NULL);
219 assert(suri_err_check_null_warnings(sh));
221 n = vsnprintf(sh->sh_err_action, sizeof (sh->sh_err_action), fmt, ap);
222 assert(n < sizeof (sh->sh_err_action));
231 suri_err_set_desc(struct suri_handle *sh, const char *fmt, ...)
240 assert(suri_err_check_null_errors(sh));
242 n = vsnprintf(sh->sh_err_desc, sizeof (sh->sh_err_desc), fmt, ap);
243 assert(n < sizeof (sh->sh_err_desc));
249 suri_err_clear_warnings(sh);
257 suri_err_set_static_desc(struct suri_handle *sh, suri_err_t err)
263 assert(suri_err_check_null_errors(sh));
267 sh->sh_err_static_desc = ERR_SURI_NOMEM;
270 sh->sh_err_static_desc = ERR_SURI_NAMETOOLONG;
279 suri_err_clear_warnings(sh);
290 suri_set_warn(struct suri_handle *sh, const char *fmt, ...)
295 assert(suri_err_check_null_errors(sh));
297 for (i = 0; i < UU_NELEM(sh->sh_warnings); ++i) {
298 if (sh->sh_warn[i] == NULL)
302 assert(i < UU_NELEM(sh->sh_warnings));
304 sh->sh_warn[i] = sh->sh_warnings[i];
306 assert(sh->sh_warn[i][0] == '\0');
308 n = vsnprintf(sh->sh_warn[i], SURI_WARN_STR_LEN, fmt, ap);
311 assert(sh->sh_warn[i + 1] == NULL);
322 suri_err_clear(struct suri_handle *sh)
326 sh->sh_err_code = ESURI_OK;
327 sh->sh_err_action[0] = '\0';
328 sh->sh_err_desc[0] = '\0';
329 sh->sh_err_static_desc = NULL;
330 (void) memset(sh->sh_warn, '\0',
331 sizeof (sh->sh_warn) * sizeof (char *));
333 sh->sh_warnings[i][0] = '\0';