[PATCH 07/14] Do not create std::string for constants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christophe de Dinechin <dinechin@xxxxxxxxxx>

As per e-mail discussions (https://patchwork.freedesktop.org/patch/200629/),
using std::string for C-style string constants is against C++ good practices,
see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rstr-zstring for reference.

Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
---
 src/spice-streaming-agent.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 8f25940..25a38a6 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -352,7 +352,7 @@ static void cursor_changes(Display *display, int event_base)
 }
 
 static void
-do_capture(const std::string &streamport, FILE *f_log)
+do_capture(const char *streamport, FILE *f_log)
 {
     streamfd = open(streamport.c_str(), O_RDWR);
     if (streamfd < 0)
@@ -438,7 +438,7 @@ done:
 
 int main(int argc, char* argv[])
 {
-    std::string streamport = "/dev/virtio-ports/com.redhat.stream.0";
+    const char *streamport = "/dev/virtio-ports/com.redhat.stream.0";
     char opt;
     const char *log_filename = NULL;
     int logmask = LOG_UPTO(LOG_WARNING);
-- 
2.13.5 (Apple Git-94)

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]