]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/commitdiff
kmatest: split regex strings to multiple lines
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 2 Sep 2016 13:01:00 +0000 (16:01 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 26 Sep 2016 06:51:34 +0000 (09:51 +0300)
Split regex strings to multiple lines to make them slightly more
readable.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
utils/kmstest.cpp

index f4fd3d5875f2d6e65f6aa0c0f8c0fd85d8f94030..cc895e3dde9496bec8c9ff47fa01e45b4421c582 100644 (file)
@@ -102,7 +102,9 @@ static void get_default_crtc(Card& card, OutputInfo& output)
 static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output)
 {
        // @12:1920x1200@60
-       const regex mode_re("(?:(@?)(\\d+):)?(?:(\\d+)x(\\d+)(i)?)(?:@([\\d\\.]+))?");
+       const regex mode_re("(?:(@?)(\\d+):)?"          // @12:
+                           "(?:(\\d+)x(\\d+)(i)?)"     // 1920x1200i
+                           "(?:@([\\d\\.]+))?");       // @60
 
        smatch sm;
        if (!regex_match(crtc_str, sm, mode_re))
@@ -165,7 +167,9 @@ static void parse_crtc(Card& card, const string& crtc_str, OutputInfo& output)
 static void parse_plane(Card& card, const string& plane_str, const OutputInfo& output, PlaneInfo& pinfo)
 {
        // 3:400,400-400x400
-       const regex plane_re("(?:(@?)(\\d+):)?(?:(\\d+),(\\d+)-)?(\\d+)x(\\d+)");
+       const regex plane_re("(?:(@?)(\\d+):)?"         // 3:
+                            "(?:(\\d+),(\\d+)-)?"      // 400,400-
+                            "(\\d+)x(\\d+)");          // 400x400
 
        smatch sm;
        if (!regex_match(plane_str, sm, plane_re))
@@ -239,7 +243,9 @@ static vector<DumbFramebuffer*> parse_fb(Card& card, const string& fb_str, unsig
        if (!fb_str.empty()) {
                // XXX the regexp is not quite correct
                // 400x400-NV12
-               const regex fb_re("(?:(\\d+)x(\\d+))?(?:-)?(\\w\\w\\w\\w)?");
+               const regex fb_re("(?:(\\d+)x(\\d+))?"          // 400x400
+                                 "(?:-)?"                      // -
+                                 "(\\w\\w\\w\\w)?");           // NV12
 
                smatch sm;
                if (!regex_match(fb_str, sm, fb_re))