diff --git a/src/reader/functional/cowl_functional.y b/src/reader/functional/cowl_functional.y index 70c4750b..4d1012a0 100644 --- a/src/reader/functional/cowl_functional.y +++ b/src/reader/functional/cowl_functional.y @@ -56,7 +56,7 @@ if (strcmp(s, "memory exhausted") == 0) { COWL_HANDLE_MEM_ERROR(); } else { - cowl_handle_syntax_error(ustring_wrap(s, strlen(s)), stream, + cowl_handle_syntax_error(ustring_wrap_buf(s), stream, (CowlErrorLoc) { .line = yylloc->last_line }); } } @@ -64,30 +64,30 @@ #ifdef YYNOMEM #define COWL_ERROR_MEM YYNOMEM #else - #define COWL_ERROR_MEM do { \ - COWL_HANDLE_MEM_ERROR(); \ - YYABORT; \ + #define COWL_ERROR_MEM do { \ + COWL_HANDLE_MEM_ERROR(); \ + YYABORT; \ } while (0) #endif - #define COWL_ERROR(CODE) do { \ - if ((CODE) == COWL_ERR_MEM) { \ - COWL_ERROR_MEM; \ - } else { \ - COWL_HANDLE_ERROR(CODE); \ - YYERROR; \ - } \ + #define COWL_ERROR(CODE) do { \ + if ((CODE) == COWL_ERR_MEM) { \ + COWL_ERROR_MEM; \ + } else { \ + COWL_HANDLE_ERROR(CODE); \ + YYERROR; \ + } \ } while (0) - #define COWL_VEC_PUSH(T, VEC, OBJ) do { \ - if (cowl_vector_push(VEC, OBJ)) COWL_ERROR_MEM; \ + #define COWL_VEC_PUSH(T, VEC, OBJ) do { \ + if (cowl_vector_push(VEC, OBJ)) COWL_ERROR_MEM; \ } while (0) - #define COWL_VEC_FINALIZE(VEC) do { \ - if (VEC) { \ - cowl_vector_release(VEC); \ - if (cowl_vector_shrink(VEC)) COWL_ERROR_MEM; \ - } \ + #define COWL_VEC_FINALIZE(VEC) do { \ + if (VEC) { \ + cowl_vector_release(VEC); \ + if (cowl_vector_shrink(VEC)) COWL_ERROR_MEM; \ + } \ } while (0) } diff --git a/test/tests/cowl_iri_tests.c b/test/tests/cowl_iri_tests.c index 12ef0c68..c31c1bca 100644 --- a/test/tests/cowl_iri_tests.c +++ b/test/tests/cowl_iri_tests.c @@ -34,7 +34,7 @@ bool cowl_test_iri_get_ns(void) { for (unsigned i = 0; i < ulib_array_count(tests); ++i) { char const *iri_str = tests[i][0]; char const *ns_str = tests[i][1]; - CowlIRI *iri = cowl_iri_from_string(ustring_wrap(iri_str, strlen(iri_str))); + CowlIRI *iri = cowl_iri_from_string(ustring_wrap_buf(iri_str)); CowlString *ns = cowl_iri_get_ns(iri); utest_assert_string(cowl_string_get_cstring(ns), ==, ns_str); cowl_iri_release(iri); @@ -53,7 +53,7 @@ bool cowl_test_iri_get_rem(void) { for (unsigned i = 0; i < ulib_array_count(tests); ++i) { char const *iri_str = tests[i][0]; char const *rem_str = tests[i][1]; - CowlIRI *iri = cowl_iri_from_string(ustring_wrap(iri_str, strlen(iri_str))); + CowlIRI *iri = cowl_iri_from_string(ustring_wrap_buf(iri_str)); CowlString *rem = cowl_iri_get_rem(iri); utest_assert_string(cowl_string_get_cstring(rem), ==, rem_str); cowl_iri_release(iri);