Parcourir la source

[libc] Allow container_of() to be used on volatile pointers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 8 ans
Parent
révision
ef0297b527
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1
    1
      src/include/stddef.h

+ 1
- 1
src/include/stddef.h Voir le fichier

@@ -34,7 +34,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
34 34
  */
35 35
 #define container_of( ptr, type, field ) ( {				\
36 36
 	type *__container;						\
37
-	const typeof ( __container->field ) *__field = (ptr);		\
37
+	const volatile typeof ( __container->field ) *__field = (ptr);	\
38 38
 	__container = ( ( ( void * ) __field ) -			\
39 39
 			offsetof ( type, field ) );			\
40 40
 	__container; } )

Chargement…
Annuler
Enregistrer