mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix documentation about struct RData's data field
Also adds a static assertion to ensure the documented behavior stays true, namely that the data field is at the same position in the RData and RTypedData structs.
This commit is contained in:
parent
a04555c8ab
commit
5aa5112443
2 changed files with 5 additions and 2 deletions
|
@ -143,8 +143,8 @@ struct RData {
|
||||||
RUBY_DATA_FUNC dfree;
|
RUBY_DATA_FUNC dfree;
|
||||||
|
|
||||||
/** Pointer to the actual C level struct that you want to wrap.
|
/** Pointer to the actual C level struct that you want to wrap.
|
||||||
* This is in between dmark and dfree to allow DATA_PTR to continue
|
* This is after dmark and dfree to allow DATA_PTR to continue to work for
|
||||||
* to work for both RData and non-embedded RTypedData.
|
* both RData and non-embedded RTypedData.
|
||||||
*/
|
*/
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "ruby/internal/dllexport.h"
|
#include "ruby/internal/dllexport.h"
|
||||||
#include "ruby/internal/error.h"
|
#include "ruby/internal/error.h"
|
||||||
#include "ruby/internal/fl_type.h"
|
#include "ruby/internal/fl_type.h"
|
||||||
|
#include "ruby/internal/static_assert.h"
|
||||||
#include "ruby/internal/stdbool.h"
|
#include "ruby/internal/stdbool.h"
|
||||||
#include "ruby/internal/value_type.h"
|
#include "ruby/internal/value_type.h"
|
||||||
|
|
||||||
|
@ -374,6 +375,8 @@ struct RTypedData {
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RBIMPL_STATIC_ASSERT(data_in_rtypeddata, offsetof(struct RData, data) == offsetof(struct RTypedData, data));
|
||||||
|
|
||||||
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
||||||
RBIMPL_ATTR_NONNULL((3))
|
RBIMPL_ATTR_NONNULL((3))
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue