Sha256: bb1cc77d4589c11d25ee18ecc83108654ed4830ee39f2dc1f176c3fcfaffefb8

Contents?: true

Size: 812 Bytes

Versions: 4

Compression:

Stored size: 812 Bytes

Contents

#include "yarp/diagnostic.h"

// Append an error to the given list of diagnostic.
bool
yp_diagnostic_list_append(yp_list_t *list, const char *start, const char *end, const char *message) {
    yp_diagnostic_t *diagnostic = (yp_diagnostic_t *) malloc(sizeof(yp_diagnostic_t));
    if (diagnostic == NULL) return false;

    *diagnostic = (yp_diagnostic_t) { .start = start, .end = end, .message = message };
    yp_list_append(list, (yp_list_node_t *) diagnostic);
    return true;
}

// Deallocate the internal state of the given diagnostic list.
void
yp_diagnostic_list_free(yp_list_t *list) {
    yp_list_node_t *node, *next;

    for (node = list->head; node != NULL; node = next) {
        next = node->next;

        yp_diagnostic_t *diagnostic = (yp_diagnostic_t *) node;
        free(diagnostic);
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yarp-0.9.0 src/diagnostic.c
yarp-0.8.0 src/diagnostic.c
yarp-0.7.0 src/diagnostic.c
yarp-0.6.0 src/diagnostic.c