<div dir="ltr"><div class="gmail_extra">Looks good</div><div class="gmail_extra"><br></div><div class="gmail_extra">acked-by: Sameeh Jubran <<a href="mailto:sameeh@daynix.com">sameeh@daynix.com</a>></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 1, 2016 at 5:54 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Avoid to use two way to handle errors.<br>
<br>
Signed-off-by: Frediano Ziglio <<a href="mailto:fziglio@redhat.com">fziglio@redhat.com</a>><br>
---<br>
 vdagent/display_configuration.<wbr>cpp | 19 +++++++------------<br>
 vdagent/display_configuration.<wbr>h   |  2 +-<br>
 2 files changed, 8 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/vdagent/display_<wbr>configuration.cpp b/vdagent/display_<wbr>configuration.cpp<br>
index 29a1030..6e7624b 100644<br>
--- a/vdagent/display_<wbr>configuration.cpp<br>
+++ b/vdagent/display_<wbr>configuration.cpp<br>
@@ -691,12 +691,8 @@ CCD::CCD()<br>
     ,_primary_detached(false)<br>
     ,_path_state(PATH_UPDATED)<br>
 {<br>
-    if (load_api()) {<br>
-        get_config_buffers();<br>
-    }<br>
-    else {<br>
-        throw std::exception();<br>
-    }<br>
+    load_api();<br>
+    get_config_buffers();<br>
 }<br>
<br>
 CCD::~CCD()<br>
@@ -801,14 +797,13 @@ void CCD::debug_print_config(const char* prefix)<br>
     }<br>
 }<br>
<br>
-bool CCD::load_api()<br>
+void CCD::load_api()<br>
 {<br>
     HMODULE hModule = GetModuleHandle(L"user32.dll")<wbr>;<br>
-    if(!hModule) {<br>
-        return false;<br>
+    if (!hModule) {<br>
+        throw std::exception();<br>
     }<br>
<br>
-    bool bFound_all(false);<br>
     do {<br>
         if (!(_pfnGetDeviceInfo = (PDISPLAYCONFIG_GETDEVICEINFO)<br>
             GetProcAddress(hModule, "DisplayConfigGetDeviceInfo"))<wbr>) {<br>
@@ -829,11 +824,11 @@ bool CCD::load_api()<br>
             GetProcAddress(hModule, "SetDisplayConfig"))) {<br>
             break;<br>
         }<br>
-        bFound_all = true;<br>
+        return;<br>
     }<br>
     while(0);<br>
<br>
-    return bFound_all;<br>
+    throw std::exception();<br>
 }<br>
<br>
 bool CCD::get_config_buffers()<br>
diff --git a/vdagent/display_<wbr>configuration.h b/vdagent/display_<wbr>configuration.h<br>
index 7abf526..ef4f989 100644<br>
--- a/vdagent/display_<wbr>configuration.h<br>
+++ b/vdagent/display_<wbr>configuration.h<br>
@@ -67,7 +67,7 @@ public:<br>
     void debug_print_config(const char* prefix = NULL);<br>
<br>
 private:<br>
-    bool load_api();<br>
+    void load_api();<br>
     bool get_config_buffers();<br>
     void free_config_buffers();<br>
     bool is_device_path(LPCTSTR device_name, DISPLAYCONFIG_PATH_INFO* path);<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/spice-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="4" color="#0b5394" face="times new roman, serif">Respectfully,<br></font><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="4" color="#0b5394" face="times new roman, serif"><b><i>Sameeh Jubran</i></b></font></div><div style="font-size:12.8px;color:rgb(136,136,136)"><i style="color:rgb(7,55,99);font-family:"times new roman",serif;font-size:large"><span style="line-height:15px"><a href="https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a" title="View public profile" name="UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_14e2c1de96f8c195_UNIQUE_ID_SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter_webProfileURL" style="color:rgb(17,85,204);margin:0px;padding:0px;border-width:0px;outline:none;vertical-align:baseline;text-decoration:none" target="_blank">Linkedin</a></span></i><br></div><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="4" face="times new roman, serif" color="#073763"><i>Junior Software Engineer @ <a href="http://www.daynix.com" target="_blank">Daynix</a>.</i></font></div></div></div></div></div></div></div>
</div></div>