static void ensure_trailing_slash(ALLEGRO_USTR *us) { int pos = al_ustr_size(us); if (al_ustr_prev_get(us, &pos) != '/') { al_ustr_append_chr(us, '/'); } }
/* Test al_ustr_prev_get. */ static void t30(void) { ALLEGRO_USTR *us = al_ustr_new("aþ€"); int pos; pos = al_ustr_size(us); CHECK(al_ustr_prev_get(us, &pos) == U_euro); CHECK(al_ustr_prev_get(us, &pos) == U_thorn); CHECK(al_ustr_prev_get(us, &pos) == 'a'); CHECK(al_ustr_prev_get(us, &pos) == -1); /* Start in the middle of þ. */ pos = 2; CHECK(al_ustr_prev_get(us, &pos) == U_thorn); al_ustr_free(us); }