Edit

kc3-lang/libxkbcommon/src/util-mem.h

Branch :

  • Show log

    Commit

  • Author : Ran Benita
    Date : 2025-01-29 15:35:22
    Hash : e120807b
    Message : Update license notices to SDPX short identifiers + update LICENSE Fix #628. Signed-off-by: Ran Benita <ran@unusedvar.com>

  • src/util-mem.h
  • /*
     * Copyright © 2020 Red Hat, Inc.
     * SPDX-License-Identifier: MIT
     */
    
    #pragma once
    
    #include "config.h"
    #include <stdlib.h>
    
    static inline void*
    _steal(void *ptr) {
        void **original = (void**)ptr;
        void *swapped = *original;
        *original = NULL;
        return swapped;
    }
    
    /**
     * Resets the pointer content and resets the data to NULL.
     */
    #ifdef _WIN32
    #define steal(ptr_) \
        _steal(ptr_)
    #else
    #define steal(ptr_) \
        (__typeof__(*(ptr_)))_steal(ptr_)
    #endif