Sha256: 50a24ca9494efea7d145ce84ac29f06f34abbc1cc6c940a61dd9587085ef5350
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
/* err.c * Copyright (c) 2011, Peter Ohler * All rights reserved. */ #include "err.h" #include <stdarg.h> void ox_err_set(Err e, VALUE clas, const char *format, ...) { va_list ap; va_start(ap, format); e->clas = clas; vsnprintf(e->msg, sizeof(e->msg) - 1, format, ap); va_end(ap); } #if __GNUC__ > 4 _Noreturn void #else void #endif ox_err_raise(Err e) { rb_raise(e->clas, "%s", e->msg); } void _ox_err_set_with_location(Err err, const char *msg, const char *xml, const char *current, const char *file, int line) { int xline = 1; int col = 1; for (; xml < current && '\n' != *current; current--) { col++; } for (; xml < current; current--) { if ('\n' == *current) { xline++; } } ox_err_set(err, ox_parse_error_class, "%s at line %d, column %d [%s:%d]\n", msg, xline, col, file, line); }
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
ox-2.14.21 | ext/ox/err.c |
ox-2.14.20 | ext/ox/err.c |
ox-2.14.19 | ext/ox/err.c |
ox-2.14.18 | ext/ox/err.c |
ox-2.14.17 | ext/ox/err.c |
ox-2.14.16 | ext/ox/err.c |
ox-2.14.15 | ext/ox/err.c |