Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:16

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef UPB_BASE_UPCAST_H_
0009 #define UPB_BASE_UPCAST_H_
0010 
0011 // Must be last.
0012 #include "upb/port/def.inc"
0013 
0014 // This macro provides a way to upcast message pointers in a way that is
0015 // somewhat more bulletproof than blindly casting a pointer. Example:
0016 //
0017 // typedef struct {
0018 //   upb_Message UPB_PRIVATE(base);
0019 // } pkg_FooMessage;
0020 //
0021 // void f(pkg_FooMessage* msg) {
0022 //   upb_Decode(UPB_UPCAST(msg), ...);
0023 // }
0024 
0025 #define UPB_UPCAST(x) (&(x)->base##_dont_copy_me__upb_internal_use_only)
0026 
0027 #include "upb/port/undef.inc"
0028 
0029 #endif /* UPB_BASE_UPCAST_H_ */