mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-22 06:11:31 +03:00
vere: rename u3_unix_{safe,cane}
This commit is contained in:
parent
60f1a44910
commit
443315f401
@ -72,7 +72,7 @@ _main_repath(c3_c* pax_c)
|
||||
fprintf(stderr, "invalid path %s\n", pax_c);
|
||||
return 0;
|
||||
}
|
||||
c3_assert(u3_unix_safe(fas_c + 1));
|
||||
c3_assert(u3_unix_cane(fas_c + 1));
|
||||
*fas_c = 0;
|
||||
dir_c = realpath(pax_c, 0);
|
||||
*fas_c = '/';
|
||||
|
@ -125,24 +125,24 @@
|
||||
/* Asserting unix fs wrappers.
|
||||
*/
|
||||
// defined in vere/io/unix.c.
|
||||
c3_t u3_unix_safe(const c3_c* pax_c);
|
||||
c3_t u3_unix_cane(const c3_c* pax_c);
|
||||
# define c3_open(a, ...) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
open(a, __VA_ARGS__);})
|
||||
# define c3_opendir(a) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
opendir(a);})
|
||||
# define c3_mkdir(a, b) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
mkdir(a, b);})
|
||||
# define c3_rmdir(a) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
rmdir(a);})
|
||||
# define c3_unlink(a) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
unlink(a);})
|
||||
# define c3_fopen(a, b) ({ \
|
||||
c3_assert(u3_unix_safe(a)); \
|
||||
c3_assert(u3_unix_cane(a)); \
|
||||
fopen(a, b);})
|
||||
|
||||
#endif /* ifndef C3_DEFS_H */
|
||||
|
@ -1168,10 +1168,10 @@
|
||||
|
||||
/** Storage, new school.
|
||||
**/
|
||||
/* u3_unix_safe(): true iff (unix) path is canonical.
|
||||
/* u3_unix_cane(): true iff (unix) path is canonical.
|
||||
*/
|
||||
c3_t
|
||||
u3_unix_safe(const c3_c* pax_c);
|
||||
u3_unix_cane(const c3_c* pax_c);
|
||||
|
||||
/* u3_unix_initial_into_card(): create initial filesystem sync card.
|
||||
*/
|
||||
|
@ -15,29 +15,29 @@ _test_safe()
|
||||
{
|
||||
c3_i ret_i = 1;
|
||||
|
||||
if ( !u3_unix_safe("a") ||
|
||||
!u3_unix_safe("a/b") ||
|
||||
!u3_unix_safe("a/b/c/defg/h/ijklmnop") )
|
||||
if ( !u3_unix_cane("a") ||
|
||||
!u3_unix_cane("a/b") ||
|
||||
!u3_unix_cane("a/b/c/defg/h/ijklmnop") )
|
||||
{
|
||||
fprintf(stderr, "_safe fail 1\n");
|
||||
ret_i = 0;
|
||||
}
|
||||
|
||||
if ( u3_unix_safe("") ||
|
||||
u3_unix_safe(".") ||
|
||||
u3_unix_safe("..") ||
|
||||
u3_unix_safe("/.") ||
|
||||
u3_unix_safe("a/b/c//") ||
|
||||
u3_unix_safe("a/b/.") ||
|
||||
u3_unix_safe("/././../.") ||
|
||||
u3_unix_safe("/../etc") )
|
||||
if ( u3_unix_cane("") ||
|
||||
u3_unix_cane(".") ||
|
||||
u3_unix_cane("..") ||
|
||||
u3_unix_cane("/.") ||
|
||||
u3_unix_cane("a/b/c//") ||
|
||||
u3_unix_cane("a/b/.") ||
|
||||
u3_unix_cane("/././../.") ||
|
||||
u3_unix_cane("/../etc") )
|
||||
{
|
||||
fprintf(stderr, "_safe fail 2\r\n");
|
||||
ret_i = 0;
|
||||
}
|
||||
|
||||
if ( !u3_unix_safe(".a") ||
|
||||
!u3_unix_safe("/.a.b.c/..c") )
|
||||
if ( !u3_unix_cane(".a") ||
|
||||
!u3_unix_cane("/.a.b.c/..c") )
|
||||
{
|
||||
fprintf(stderr, "_safe fail 3\r\n");
|
||||
ret_i = 0;
|
||||
|
@ -42,7 +42,7 @@ u3_lmdb_init(const c3_c* pax_c, size_t siz_i)
|
||||
MDB_env* env_u;
|
||||
c3_w ret_w;
|
||||
|
||||
c3_assert(u3_unix_safe(pax_c));
|
||||
c3_assert(u3_unix_cane(pax_c));
|
||||
|
||||
if ( (ret_w = mdb_env_create(&env_u)) ) {
|
||||
mdb_logerror(stderr, ret_w, "lmdb: init fail");
|
||||
|
@ -84,7 +84,7 @@ u3_foil_folder(const c3_c* pax_c)
|
||||
uv_dirent_t den_u;
|
||||
c3_i err_i;
|
||||
|
||||
c3_assert(u3_unix_safe(pax_c));
|
||||
c3_assert(u3_unix_cane(pax_c));
|
||||
|
||||
/* open directory, synchronously
|
||||
*/
|
||||
|
@ -73,10 +73,10 @@ struct _u3_ufil;
|
||||
void
|
||||
u3_unix_ef_look(u3_unix* unx_u, u3_noun mon, u3_noun all);
|
||||
|
||||
/* u3_unix_safe(): true iff (unix) path is canonical.
|
||||
/* u3_unix_cane(): true iff (unix) path is canonical.
|
||||
*/
|
||||
c3_t
|
||||
u3_unix_safe(const c3_c* pax_c)
|
||||
u3_unix_cane(const c3_c* pax_c)
|
||||
{
|
||||
if ( 0 == pax_c ) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user