Lines Matching refs:err
55 error_format(const atf_error_t err, char *buf, size_t buflen)
57 PRE(err != NULL);
58 snprintf(buf, buflen, "Error '%s'", err->m_type);
63 error_init(atf_error_t err, const char *type, void *data, size_t datalen,
71 err->m_free = false;
72 err->m_type = type;
73 err->m_format = (format == NULL) ? error_format : format;
77 err->m_data = NULL;
79 err->m_data = malloc(datalen);
80 if (err->m_data == NULL) {
83 memcpy(err->m_data, data, datalen);
97 atf_error_t err;
103 err = malloc(sizeof(*err));
104 if (err == NULL)
105 err = atf_no_memory_error();
107 if (!error_init(err, type, data, datalen, format)) {
108 free(err);
109 err = atf_no_memory_error();
111 err->m_free = true;
116 INV(err != NULL);
118 return err;
122 atf_error_free(atf_error_t err)
127 PRE(err != NULL);
129 freeit = err->m_free;
131 if (err->m_data != NULL)
132 free(err->m_data);
135 free(err);
147 atf_is_error(const atf_error_t err)
149 return err != NULL;
153 atf_error_is(const atf_error_t err, const char *type)
155 PRE(err != NULL);
157 return strcmp(err->m_type, type) == 0;
161 atf_error_data(const atf_error_t err)
163 PRE(err != NULL);
165 return err->m_data;
169 atf_error_format(const atf_error_t err, char *buf, size_t buflen)
171 PRE(err != NULL);
172 err->m_format(err, buf, buflen);
191 libc_format(const atf_error_t err, char *buf, size_t buflen)
195 PRE(atf_error_is(err, "libc"));
197 data = atf_error_data(err);
204 atf_error_t err;
213 err = atf_error_new("libc", &data, sizeof(data), libc_format);
215 return err;
219 atf_libc_error_code(const atf_error_t err)
223 PRE(atf_error_is(err, "libc"));
225 data = atf_error_data(err);
231 atf_libc_error_msg(const atf_error_t err)
235 PRE(atf_error_is(err, "libc"));
237 data = atf_error_data(err);
250 no_memory_format(const atf_error_t err, char *buf, size_t buflen)
252 PRE(atf_error_is(err, "no_memory"));