Skip to content

StrAllocator

Description

Allocator backing the string’s storage.

Parameters

Name Direction Description
str in String to query.

Usage example (Cross-references)

Usage examples (Cross-references)
                    (fmt_info->flags & FMT_FLAG_HAS_PRECISION) != 0,
                    (fmt_info->flags & FMT_FLAG_CAPS) != 0,
                    StrAllocator(o)
                )) {
                return false;
                    fmt_info->precision,
                    (fmt_info->flags & FMT_FLAG_HAS_PRECISION) != 0,
                    StrAllocator(o)
                )) {
                return false;
                Str bit_str;
    
                if (!bitvec_try_to_str(&bit_str, bv, StrAllocator(o))) {
                    return false;
                }
            }
    
            u8 *buffer = (u8 *)AllocatorAlloc(StrAllocator(o), byte_len * sizeof(u8), true);
    
            if (!buffer) {
            (void)IntToBytesBE(value, buffer, byte_len);
            if (!write_char_internal(o, fmt_info->flags, (Zstr)buffer, byte_len)) {
                AllocatorFree(StrAllocator(o), buffer);
                return false;
            }
                return false;
            }
            AllocatorFree(StrAllocator(o), buffer);
            return true;
        }
    
        if (radix == 10) {
            if (!int_try_to_str(&temp, value, StrAllocator(o))) {
                return false;
            }
            }
        } else {
            if (!int_try_to_str_radix(&temp, value, radix, (fmt_info->flags & FMT_FLAG_CAPS) != 0, StrAllocator(o))) {
                return false;
            }
    
        // (1) exact CodeView path
        *out_path = StrInit(StrAllocator(out_path));
        StrPushBackMany(out_path, cv->pdb_path);
        if (sys_path_exists(StrBegin(out_path)))
    Str *GetCurrentExecutablePath(Str *exe_path) {
        ValidateStr(exe_path);
        Allocator *alloc = StrAllocator(exe_path);
    
    #if PLATFORM_WINDOWS
        if (VecAllocator(&self->entries))
            VecDeinit(&self->entries);
        if (StrAllocator(&self->string_pool))
            StrDeinit(&self->string_pool);
        MemSet(self, 0, sizeof(*self));
    
        bool result = ok && (ZstrCompare(StrBegin(&text), "-123.45") == 0) &&
                      (StrAllocator(&text)->effort == alloc.base.effort) &&
                      (StrAllocator(&text)->retry_limit == alloc.base.retry_limit);
        bool result = ok && (ZstrCompare(StrBegin(&text), "-123.45") == 0) &&
                      (StrAllocator(&text)->effort == alloc.base.effort) &&
                      (StrAllocator(&text)->retry_limit == alloc.base.retry_limit);
    
        StrDeinit(&text);
    
        ok     = BitVecTryToStr(&str, &bv);
        result = result && ok && (StrAllocator(&str)->effort == alloc.base.effort) &&
                 (StrAllocator(&str)->retry_limit == alloc.base.retry_limit) &&
                 (ZstrCompare(StrBegin(&str), "101001") == 0);
        ok     = BitVecTryToStr(&str, &bv);
        result = result && ok && (StrAllocator(&str)->effort == alloc.base.effort) &&
                 (StrAllocator(&str)->retry_limit == alloc.base.retry_limit) &&
                 (ZstrCompare(StrBegin(&str), "101001") == 0);
    
        bool result = ok && (ZstrCompare(StrBegin(&text), "BEEF") == 0) &&
                      (StrAllocator(&text)->effort == alloc.base.effort) &&
                      (StrAllocator(&text)->retry_limit == alloc.base.retry_limit);
        bool result = ok && (ZstrCompare(StrBegin(&text), "BEEF") == 0) &&
                      (StrAllocator(&text)->effort == alloc.base.effort) &&
                      (StrAllocator(&text)->retry_limit == alloc.base.retry_limit);
    
        StrDeinit(&text);
        ValidateStr(&dst);
    
        bool dup_allocator_matches = (StrAllocator(&dup) == StrAllocator(&src));
        bool dst_allocator_matches = copied && (StrAllocator(&dst) == StrAllocator(&src));
    
        bool dup_allocator_matches = (StrAllocator(&dup) == StrAllocator(&src));
        bool dst_allocator_matches = copied && (StrAllocator(&dst) == StrAllocator(&src));
    
        bool result = copied && StrLen(&dup) == StrLen(&src) && StrLen(&dst) == StrLen(&src) &&
Last updated on