Edit

kc3-lang/libxkbcommon/src/atom.h

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-09-22 10:49:18
    Hash : 4421a358
    Message : xkbcomp: Use keycode name LUT for xkb_symbols Replace linear search with O(1). On my setup I get 1.05x speedup compared to previous commit and 1.09x speedup compared to 44fad8a067d221ec0365455bc00c4c3c94bca0ad (no keycode name LUT).

  • src/atom.h
  • /*
     * Copyright © 2009 Dan Nicholson
     * SPDX-License-Identifier: MIT
     */
    #pragma once
    
    #include "config.h"
    
    #include <stddef.h>
    #include <stdint.h>
    #include <stdbool.h>
    
    #include "darray.h"
    #include "utils.h"
    
    /** Atoms are indexes into a `darray` */
    typedef darray_size_t xkb_atom_t;
    
    #define XKB_ATOM_NONE 0
    
    struct atom_table;
    
    XKB_EXPORT_PRIVATE struct atom_table *
    atom_table_new(void);
    
    XKB_EXPORT_PRIVATE void
    atom_table_free(struct atom_table *table);
    
    XKB_EXPORT_PRIVATE darray_size_t
    atom_table_size(struct atom_table *table);
    
    XKB_EXPORT_PRIVATE xkb_atom_t
    atom_intern(struct atom_table *table, const char *string, size_t len, bool add);
    
    XKB_EXPORT_PRIVATE const char *
    atom_text(struct atom_table *table, xkb_atom_t atom);