Browse Source

container_of: Make example compile cleanly with -Wunused

Make register_timer "use" my_timer_callback and its own args.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 9 years ago
parent
commit
c3a934d277
1 changed files with 7 additions and 5 deletions
  1. 7 5
      ccan/container_of/_info

+ 7 - 5
ccan/container_of/_info

@@ -26,17 +26,19 @@
  *		struct timer timer;
  *		struct timer timer;
  *	};
  *	};
  *
  *
- *	static void register_timer(struct timer *timer)
- *	{
- *		//...
- *	}
- *
  *	static void my_timer_callback(struct timer *timer)
  *	static void my_timer_callback(struct timer *timer)
  *	{
  *	{
  *		struct info *info = container_of(timer, struct info, timer);
  *		struct info *info = container_of(timer, struct info, timer);
  *		printf("my_stuff is %u\n", info->my_stuff);
  *		printf("my_stuff is %u\n", info->my_stuff);
  *	}
  *	}
  *
  *
+ *	static void register_timer(struct timer *timer)
+ *	{
+ *		(void)timer;
+ *		(void)my_timer_callback;
+ *		//...
+ *	}
+ *
  *	int main(void)
  *	int main(void)
  *	{
  *	{
  *		struct info info = { .my_stuff = 1 };
  *		struct info info = { .my_stuff = 1 };