[PATCH] screenshooter: Add missing field initializers for wl_output_listener

Christopher Michael cpmichael at osg.samsung.com
Tue Jul 7 10:27:31 PDT 2015


This patch adds missing placeholders for the wl_output listener 
functions 'done' and 'scale. The placeholders added here are no-op 
function placeholders as the done and scale callbacks are not used in 
the screenshot client.

Signed-off-by: Chris Michael <cp.michael at samsung.com>
---
  clients/screenshot.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/clients/screenshot.c b/clients/screenshot.c
index 0d9b320..03f63e0 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -112,11 +112,21 @@ display_handle_mode(void *data,
  	}
  }

+static void
+display_handle_done(void *data, struct wl_output *wl_output)
+{
+}
+
+static void
+display_handle_scale(void *data, struct wl_output *output, int32_t scale)
+{
+}
+
  static const struct wl_output_listener output_listener = {
  	display_handle_geometry,
  	display_handle_mode,
-	NULL,
-	NULL,
+	display_handle_done,
+	display_handle_scale,
  };

  static void
-- 
2.4.4



On 07/07/2015 01:18 PM, Jasper St. Pierre wrote:
> Wacky. In any case, NULL is not a valid listener, which is sort of
> terrible, but it is how it is. You need to create an empty function
> that does nothing.
>
> On Tue, Jul 7, 2015 at 10:17 AM, Christopher Michael
> <cpmichael at osg.samsung.com> wrote:
>> On 07/07/2015 01:15 PM, Jasper St. Pierre wrote:
>>>
>>> Shouldn't missing fields in structs be auto-initialized to 0 / NULL? I
>>> thought that was part of the C specification.
>>>
>>
>> I thought so also however when compiling some other code which was also
>> creating a wl_output_listener, I uncovered the warnings about missing field
>> initializers. When I looked/referenced the existing screenshooting code I
>> noticed that they were missing from there also, so I just made a quick patch
>> to address that.
>>
>> Cheers,
>> Chris
>>
>>
>>> On Tue, Jul 7, 2015 at 8:52 AM, Christopher Michael
>>> <cpmichael at osg.samsung.com> wrote:
>>>>
>>>> This patch adds missing placeholders for the wl_output listener
>>>> functions 'done' and 'scale. Currently these placeholders are being
>>>> set to NULL as the done and scale callbacks are not used in the
>>>> screenshot client.
>>>>
>>>> Signed-off-by: Chris Michael <cp.michael at samsung.com>
>>>> ---
>>>>    clients/screenshot.c | 4 +++-
>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/clients/screenshot.c b/clients/screenshot.c
>>>> index f11e3ba..0d9b320 100644
>>>> --- a/clients/screenshot.c
>>>> +++ b/clients/screenshot.c
>>>> @@ -114,7 +114,9 @@ display_handle_mode(void *data,
>>>>
>>>>    static const struct wl_output_listener output_listener = {
>>>>        display_handle_geometry,
>>>> -    display_handle_mode
>>>> +    display_handle_mode,
>>>> +    NULL,
>>>> +    NULL,
>>>>    };
>>>>
>>>>    static void
>>>> --
>>>> 2.4.4
>>>> _______________________________________________
>>>> wayland-devel mailing list
>>>> wayland-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>>
>>>
>>>
>>>
>>
>
>
>



More information about the wayland-devel mailing list