Hash :
e120807b
Author :
Date :
2025-01-29T15:35:22
Update license notices to SDPX short identifiers + update LICENSE Fix #628. Signed-off-by: Ran Benita <ran@unusedvar.com>
/*
* 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