[similarity] using NULL-terminated varargs in double metaphone instead of specifying the number of arguments, should be more maintainable

--- src/double_metaphone.c
+++ src/double_metaphone.c
@@ -27,19 +27,17 @@
         || strstr(s, "WITZ");
 }

-static inline bool substring_equals(char *str, size_t len, ssize_t index, size_t substr_len, size_t nargs, ...) {
+static inline bool substring_equals(char *str, size_t len, ssize_t index, size_t substr_len, ...) {
     char *string_at_index = get_string_at(str, len, index);
     if (string_at_index == NULL) return false;

     va_list args;
-    char *sub;
-
-    va_start(args, nargs);
+    va_start(args, substr_len);

     bool matched = false;

-    for (size_t i = 0; i < nargs; i++) {
-        sub = va_arg(args, char *);
+    while (true) {
+        char *sub = va_arg(args, char *);
         if (sub == NULL) break;

         if (utf8_compare_len(string_at_index, sub, substr_len) == 0) {
@@ -90,13 +88,13 @@
     size_t current = 0;
     size_t last = len - 1;

-    if (substring_equals(str, len, current, 2, 1, "ʻ")) {
+    if (substring_equals(str, len, current, 2, "ʻ", NULL)) {
         str += 2;
     } else if (get_char_at(str, len, current) == '\'') {
         str++;
     }

-    if (substring_equals(str, len, current, 2, 5, "GN", "KN", "PN", "WR", "PS")) {
+    if (substring_equals(str, len, current, 2, "GN", "KN", "PN", "WR", "PS", NULL)) {
         current++;
     } else if (get_char_at(str, len, current) == 'X') {
         char_array_append(primary, "S");
@@ -125,7 +123,7 @@
             }
             continue;
         // Ç - C with cedilla (denormalized)
-        } else if (substring_equals(str, len, current, 3, 1, "C\xcc\xa7")) {
+        } else if (substring_equals(str, len, current, 3, "C\xcc\xa7", NULL)) {
             char_array_append(primary, "S");
             char_array_append(secondary, "S");
             current += 2;
@@ -133,11 +131,11 @@
             // various germanic
             if ((current > 1)
                 && !is_vowel(get_char_at(str, len, current - 2))
-                && (substring_equals(str, len, current - 1, 3, 1, "ACH")
-                    && !substring_equals(str, len, current + 2, 1, 3, "O", "A", "U"))
+                && (substring_equals(str, len, current - 1, 3, "ACH", NULL)
+                    && !substring_equals(str, len, current + 2, 1, "O", "A", "U", NULL))
                 && ((get_char_at(str, len, current + 2) != 'I')
                     && ((get_char_at(str, len, current + 2) != 'E')
-                        || substring_equals(str, len, current - 2, 6, 2, "BACHER", "MACHER"))
+                        || substring_equals(str, len, current - 2, 6, "BACHER", "MACHER", NULL))
                    )
                 )
             {
@@ -149,7 +147,7 @@

             // special case for "caesar"
             if ((current == 0)
-                && substring_equals(str, len, current, 6, 1, "CAESAR"))
+                && substring_equals(str, len, current, 6, "CAESAR", NULL))
             {
                 char_array_append(primary, "S");
                 char_array_append(secondary, "K");
@@ -158,17 +156,17 @@
             }

             // Italian e.g. "chianti"
-            if (substring_equals(str, len, current, 4, 1, "CHIA")) {
+            if (substring_equals(str, len, current, 4, "CHIA", NULL)) {
                 char_array_append(primary, "K");
                 char_array_append(secondary, "K");
                 current += 2;
                 continue;
             }

-            if (substring_equals(str, len, current, 2, 1, "CH")) {
+            if (substring_equals(str, len, current, 2, "CH", NULL)) {
                 // "michael"
                 if ((current > 0)
-                    && substring_equals(str, len, current, 4, 1, "CHAE"))
+                    && substring_equals(str, len, current, 4, "CHAE", NULL))
                 {
                     char_array_append(primary, "K");
                     char_array_append(secondary, "X");
@@ -178,9 +176,9 @@

                 // Greek roots e.g. "chemistry", "chorus"
                 if ((current == 0)
-                    && (substring_equals(str, len, current + 1, 5, 3, "HARAC", "HARIS", "HOREO")
-                     || substring_equals(str, len, current + 1, 4, 3, "HIRO", "HAOS", "HAOT")
-                     || (substring_equals(str, len, current + 1, 3, 5, "HOR", "HYM", "HIA", "HEM", "HIM") && !substring_equals(str, len, current + 1, 5, 2, "HEMIN")))
+                    && (substring_equals(str, len, current + 1, 5, "HARAC", "HARIS", "HOREO", NULL)
+                     || substring_equals(str, len, current + 1, 4, "HIRO", "HAOS", "HAOT", NULL)
+                     || (substring_equals(str, len, current + 1, 3, "HOR", "HYM", "HIA", "HEM", "HIM", NULL) && !substring_equals(str, len, current + 1, 5, "HEMIN", NULL)))
                     )
                 {
                     char_array_append(primary, "K");
@@ -191,20 +189,20 @@

                 // Germanic, Greek, or otherwise "ch" for "kh" sound
                 if (
-                      (substring_equals(str, len, 0, 4, 2, "VAN ", "VON ")
-                       || substring_equals(str, len, current - 5, 5, 2, " VAN ", " VON ")
-                       || substring_equals(str, len, 0, 3, 1, "SCH"))
+                      (substring_equals(str, len, 0, 4, "VAN ", "VON ", NULL)
+                       || substring_equals(str, len, current - 5, 5, " VAN ", " VON ", NULL)
+                       || substring_equals(str, len, 0, 3, "SCH", NULL))
                       // "ochestra", "orchid", "architect" but not "arch"
-                      || substring_equals(str, len, current - 2, 6, 3, "ORCHES", "ARCHIT", "ORCHID")
-                      || substring_equals(str, len, current + 2, 1, 2, "T", "S")
+                      || substring_equals(str, len, current - 2, 6, "ORCHES", "ARCHIT", "ORCHID", NULL)
+                      || substring_equals(str, len, current + 2, 1, "T", "S", NULL)
                       || (
-                            (((current == 0) || substring_equals(str, len, current - 1, 1, 4, "A", "O", "U", "E"))
+                            (((current == 0) || substring_equals(str, len, current - 1, 1, "A", "O", "U", "E", NULL))
                              // e.g. not "breach", "broach", "pouch", "beech", etc.
-                             && !substring_equals(str, len, current - 2, 2, 6, "EA", "OU", "EE", "OA", "OO", "AU")
+                             && !substring_equals(str, len, current - 2, 2, "EA", "OU", "EE", "OA", "OO", "AU", NULL)
                              // e.g. not "lunch", "birch", "gulch"
-                             && !substring_equals(str, len, current - 1, 1, 3, "L", "R", "N"))
+                             && !substring_equals(str, len, current - 1, 1, "L", "R", "N", NULL))
                             // e.g. "wachtler", "wechsler", but not "tichner"
-                            && ((current + 1 == last) || substring_equals(str, len, current + 2, 1, 10, "L", "R", "N", "M", "B", "H", "F", "V", "W", " "))
+                            && ((current + 1 == last) || substring_equals(str, len, current + 2, 1, "L", "R", "N", "M", "B", "H", "F", "V", "W", " ", NULL))
                          )
                    )
                 {
@@ -212,7 +210,7 @@
                     char_array_append(secondary, "K");
                 } else {
                     if (current > 0) {
-                        if (substring_equals(str, len, 0, 2, 1, "MC")) {
+                        if (substring_equals(str, len, 0, 2, "MC", NULL)) {
                             char_array_append(primary, "K");
                             char_array_append(secondary, "K");
                         } else {
@@ -229,8 +227,8 @@
             }

             // e.g, "czerny"
-            if (substring_equals(str, len, current, 2, 1, "CZ")
-                && !substring_equals(str, len, current - 2, 4, 1, "WICZ"))
+            if (substring_equals(str, len, current, 2, "CZ", NULL)
+                && !substring_equals(str, len, current - 2, 4, "WICZ", NULL))
             {
                 char_array_append(primary, "S");
                 char_array_append(secondary, "X");
@@ -239,23 +237,23 @@
             }

             // double 'C' but not if e.g. "McClellan"
-            if (substring_equals(str, len, current, 2, 1, "CC")
+            if (substring_equals(str, len, current, 2, "CC", NULL)
                 && !((current == 1) && get_char_at(str, len, 0) == 'M'))
             {
                 // "bellocchio" but not "bacchus"
-                if (substring_equals(str, len, current + 2, 1, 3, "I", "E", "H")
-                    && !substring_equals(str, len, current + 2, 3, 4, "HUS", "HUM", "HUN", "HAN"))
+                if (substring_equals(str, len, current + 2, 1, "I", "E", "H", NULL)
+                    && !substring_equals(str, len, current + 2, 3, "HUS", "HUM", "HUN", "HAN", NULL))
                 {
                     // "accident", "accede", "succeed"
                     if (((current == 1)
                          && (get_char_at(str, len, current - 1) == 'A'))
-                        || substring_equals(str, len, current - 1, 5, 2, "UCCEE", "UCCES"))
+                        || substring_equals(str, len, current - 1, 5, "UCCEE", "UCCES", NULL))
                     {
                         char_array_append(primary, "KS");
                         char_array_append(secondary, "KS");
                     // "pinocchio" but not "riccio" or "picchu"
                     } else if (get_char_at(str, len, current + 2) == 'H'
-                           && !substring_equals(str, len, current + 2, 2, 2, "HU", "HA")) {
+                           && !substring_equals(str, len, current + 2, 2, "HU", "HA", NULL)) {
                         char_array_append(primary, "K");
                         char_array_append(secondary, "X");
                     } else {
@@ -273,15 +271,15 @@
                 }
             }

-            if (substring_equals(str, len, current, 2, 3, "CK", "CG", "CQ")) {
+            if (substring_equals(str, len, current, 2, "CK", "CG", "CQ", NULL)) {
                 char_array_append(primary, "K");
                 char_array_append(secondary, "K");
                 current += 2;
                 continue;
             }

-            if (substring_equals(str, len, current, 2, 4, "CI", "CJ", "CE", "CY")) {
-                if (substring_equals(str, len, current, 3, 5, "CIO", "CIE", "CIA", "CIU")) {
+            if (substring_equals(str, len, current, 2, "CI", "CJ", "CE", "CY", NULL)) {
+                if (substring_equals(str, len, current, 3, "CIO", "CIE", "CIA", "CIU", NULL)) {
                     char_array_append(primary, "S");
                     char_array_append(secondary, "X");
                 } else {
@@ -296,10 +294,10 @@
             char_array_append(primary, "K");
             char_array_append(secondary, "K");

-            if (substring_equals(str, len, current + 1, 2, 3, " C", " Q", " G")) {
+            if (substring_equals(str, len, current + 1, 2, " C", " Q", " G", NULL)) {
                 current += 3;
-            } else if (substring_equals(str, len, current + 1, 1, 3, "C", "K", "Q")
-                   && !substring_equals(str, len, current + 1, 2, 2, "CE", "CI"))
+            } else if (substring_equals(str, len, current + 1, 1, "C", "K", "Q", NULL)
+                   && !substring_equals(str, len, current + 1, 2, "CE", "CI", NULL))
             {
                 current += 2;
             } else {
@@ -308,8 +306,8 @@

             continue;
         } else if (c == 'D') {
-            if (substring_equals(str, len, current, 2, 1, "DG")) {
-                if (substring_equals(str, len, current + 2, 1, 3, "I", "E", "Y")) {
+            if (substring_equals(str, len, current, 2, "DG", NULL)) {
+                if (substring_equals(str, len, current + 2, 1, "I", "E", "Y", NULL)) {
                     // e.g. "edge"
                     char_array_append(primary, "J");
                     char_array_append(secondary, "J");
@@ -323,7 +321,7 @@
                 }
             }

-            if (substring_equals(str, len, current, 2, 2, "DT", "DD")) {
+            if (substring_equals(str, len, current, 2, "DT", "DD", NULL)) {
                 char_array_append(primary, "T");
                 char_array_append(secondary, "T");
                 current += 2;
@@ -370,13 +368,13 @@
                 // Parker's rule (with some further refinements) - e.g. "hugh"
                 if (
                     ((current > 1)
-                     && substring_equals(str, len, current - 2, 1, 3, "B", "H", "D"))
+                     && substring_equals(str, len, current - 2, 1, "B", "H", "D", NULL))
                     // e.g. "bough"
                     || ((current > 2)
-                        && substring_equals(str, len, current - 3, 1, 3, "B", "H", "D"))
+                        && substring_equals(str, len, current - 3, 1, "B", "H", "D", NULL))
                     // e.g. "broughton"
                     || ((current > 3)
-                        && substring_equals(str, len, current - 4, 1, 2, "B", "H"))
+                        && substring_equals(str, len, current - 4, 1, "B", "H", NULL))
                     )
                 {
                     current += 2;
@@ -385,7 +383,7 @@
                     // e.g. "laugh", "McLaughlin", "cough", "gough", "rough", "tough"
                     if ((current > 2)
                         && (get_char_at(str, len, current - 1) == 'U')
-                        && substring_equals(str, len, current - 3, 1, 5, "C", "G", "L", "R", "T"))
+                        && substring_equals(str, len, current - 3, 1, "C", "G", "L", "R", "T", NULL))
                     {
                         char_array_append(primary, "F");
                         char_array_append(secondary, "F");
@@ -408,7 +406,7 @@
                     char_array_append(primary, "KN");
                     char_array_append(secondary, "N");
                 // not e.g. "cagney"
-                } else if (!substring_equals(str, len, current + 2, 2, 1, "EY")
+                } else if (!substring_equals(str, len, current + 2, 2, "EY", NULL)
                         && (get_char_at(str, len, current + 1) != 'Y')
                         && !slavo_germanic)
                 {
@@ -423,7 +421,7 @@
             }

             // "tagliaro"
-            if (substring_equals(str, len, current + 1, 2, 1, "LI")
+            if (substring_equals(str, len, current + 1, 2, "LI", NULL)
                 && !slavo_germanic)
             {
                 char_array_append(primary, "KL");
@@ -435,9 +433,9 @@
             // -ges-, -gep-, -gel-, -gie- at beginning
             if ((current == 0)
                 && ((get_char_at(str, len, current + 1) == 'Y')
-                    || substring_equals(str, len, current + 1, 2, 11, "ES", "EP",
+                    || substring_equals(str, len, current + 1, 2, "ES", "EP",
                                         "EB", "EL", "EY", "IB", "IL", "IN", "IE",
-                                        "EI", "ER")))
+                                        "EI", "ER", NULL)))
             {
                 char_array_append(primary, "K");
                 char_array_append(secondary, "J");
@@ -447,11 +445,11 @@

             // -ger-, -gy-
             if (
-                (substring_equals(str, len, current + 1, 2, 1, "ER")
+                (substring_equals(str, len, current + 1, 2, "ER", NULL)
                  || (get_char_at(str, len, current + 1) == 'Y'))
-                && !substring_equals(str, len, 0, 6, 3, "DANGER", "RANGER", "MANGER")
-                && !substring_equals(str, len, current - 1, 1, 2, "E", "I")
-                && !substring_equals(str, len, current - 1, 3, 2, "RGY", "OGY")
+                && !substring_equals(str, len, 0, 6, "DANGER", "RANGER", "MANGER", NULL)
+                && !substring_equals(str, len, current - 1, 1, "E", "I", NULL)
+                && !substring_equals(str, len, current - 1, 3, "RGY", "OGY", NULL)
                 )
             {
                 char_array_append(primary, "K");
@@ -461,22 +459,22 @@
             }

             // italian e.g. "viaggi"
-            if (substring_equals(str, len, current + 1, 1, 3, "E", "I", "Y")
-                || substring_equals(str, len, current - 1, 4, 2, "AGGI", "OGGI"))
+            if (substring_equals(str, len, current + 1, 1, "E", "I", "Y", NULL)
+                || substring_equals(str, len, current - 1, 4, "AGGI", "OGGI", NULL))
             {
                 // obvious germanic
                 if (
-                    (substring_equals(str, len, 0, 4, 2, "VAN ", "VON ")
-                     || substring_equals(str, len, current - 5, 5, 2, " VAN ", " VON ")
-                     || substring_equals(str, len, 0, 3, 1, "SCH"))
-                    || substring_equals(str, len, current + 1, 2, 1, "ET"))
+                    (substring_equals(str, len, 0, 4, "VAN ", "VON ", NULL)
+                     || substring_equals(str, len, current - 5, 5, " VAN ", " VON ", NULL)
+                     || substring_equals(str, len, 0, 3, "SCH", NULL))
+                    || substring_equals(str, len, current + 1, 2, "ET", NULL))
                 {
                     char_array_append(primary, "K");
                     char_array_append(secondary, "K");

                 } else {
-                    if (substring_equals(str, len, current + 1, 4, 1, "IER ")
-                        || ((current == len - 3) && substring_equals(str, len, current + 1, 3, 1, "IER")))
+                    if (substring_equals(str, len, current + 1, 4, "IER ", NULL)
+                        || ((current == len - 3) && substring_equals(str, len, current + 1, 3, "IER", NULL)))
                     {
                         char_array_append(primary, "J");
                         char_array_append(secondary, "J");
@@ -513,13 +511,13 @@
             continue;
         } else if (c == 'J') {
             // obvious Spanish, "Jose", "San Jacinto"
-            if (substring_equals(str, len, current, 4, 1, "JOSE")
-                || substring_equals(str, len, current, 5, 1, "JOSÉ")
-                || substring_equals(str, len, 0, 4, 1, "SAN "))
+            if (substring_equals(str, len, current, 4, "JOSE", NULL)
+                || substring_equals(str, len, current, 5, "JOSÉ", NULL)
+                || substring_equals(str, len, 0, 4, "SAN ", NULL))
             {
                 if (((current == 0)
                      && (get_char_at(str, len, current + 4) == ' '))
-                    || substring_equals(str, len, 0, 4, 1, "SAN "))
+                    || substring_equals(str, len, 0, 4, "SAN ", NULL))
                 {
                     char_array_append(primary, "H");
                     char_array_append(secondary, "H");
@@ -533,8 +531,8 @@
             }

             if ((current == 0)
-                && !substring_equals(str, len, current, 4, 1, "JOSE")
-                && !substring_equals(str, len, current, 5, 1, "JOSÉ"))
+                && !substring_equals(str, len, current, 4, "JOSE", NULL)
+                && !substring_equals(str, len, current, 5, "JOSÉ", NULL))
             {
                 // Yankelovich/Jankelowicz
                 char_array_append(primary, "J");
@@ -551,12 +549,12 @@
                     char_array_append(primary, "J");
                     char_array_append(secondary, "H");
                 } else {
-                    if (current == last || ((current == last - 1 || get_char_at(str, len, current + 2) == ' ') && isalpha(get_char_at(str, len, current - 1)) && substring_equals(str, len, current + 1, 1, 2, "A", "O"))) {
+                    if (current == last || ((current == last - 1 || get_char_at(str, len, current + 2) == ' ') && isalpha(get_char_at(str, len, current - 1)) && substring_equals(str, len, current + 1, 1, "A", "O", NULL))) {
                         char_array_append(primary, "J");
                     } else {
-                        if (!substring_equals(str, len, current + 1, 1, 8, "L", "T",
-                                              "K", "S", "N", "M", "B", "Z")
-                            && !substring_equals(str, len, current - 1, 1, 3, "S", "K", "L"))
+                        if (!substring_equals(str, len, current + 1, 1, "L", "T",
+                                              "K", "S", "N", "M", "B", "Z", NULL)
+                            && !substring_equals(str, len, current - 1, 1, "S", "K", "L", NULL))
                         {
                             char_array_append(primary, "J");
                             char_array_append(secondary, "J");
@@ -586,10 +584,10 @@
             if (get_char_at(str, len, current + 1) == 'L') {
                 // Spanish e.g. "Cabrillo", "Gallegos"
                 if (((current == (len - 3))
-                     && substring_equals(str, len, current - 1, 4, 3, "ILLO", "ILLA", "ALLE"))
-                    || ((substring_equals(str, len, last - 1, 2, 2, "AS", "OS")
-                      || substring_equals(str, len, last, 1, 2, "A", "O"))
-                      && substring_equals(str, len, current - 1, 4, 1, "ALLE")
+                     && substring_equals(str, len, current - 1, 4, "ILLO", "ILLA", "ALLE", NULL))
+                    || ((substring_equals(str, len, last - 1, 2, "AS", "OS", NULL)
+                      || substring_equals(str, len, last, 1, "A", "O", NULL))
+                      && substring_equals(str, len, current - 1, 4, "ALLE", NULL)
                       )
                     )
                 {
@@ -606,9 +604,9 @@
             char_array_append(secondary, "L");
             continue;
         } else if (c == 'M') {
-            if ((substring_equals(str, len, current - 1, 3, 1, "UMB")
+            if ((substring_equals(str, len, current - 1, 3, "UMB", NULL)
                 && (((current + 1) == last)
-                    || substring_equals(str, len, current + 2, 2, 1, "ER")))
+                    || substring_equals(str, len, current + 2, 2, "ER", NULL)))
                 || (get_char_at(str, len, current + 1) == 'M'))
             {
                 current += 2;
@@ -619,7 +617,7 @@
             char_array_append(secondary, "M");
             continue;
         // Ñ (NFD normalized)
-        } else if (substring_equals(str, len, current, 3, 1, "N\xcc\x83")) {
+        } else if (substring_equals(str, len, current, 3, "N\xcc\x83", NULL)) {
             current += 3;
             char_array_append(primary, "N");
             char_array_append(secondary, "N");
@@ -635,7 +633,7 @@
             char_array_append(secondary, "N");
             continue;
         } else if (c == 'P') {
-            if (get_char_at(str, len, current + 1) == 'H') {
+            if (substring_equals(str, len, current + 1, 1, "H", "F", NULL)) {
                 char_array_append(primary, "F");
                 char_array_append(secondary, "F");
                 current += 2;
@@ -643,7 +641,7 @@
             }

             // also account for "Campbell", "raspberry"
-            if (substring_equals(str, len, current + 1, 1, 2, "P", "B")) {
+            if (substring_equals(str, len, current + 1, 1, "P", "B", NULL)) {
                 current += 2;
             } else {
                 current++;
@@ -666,8 +664,8 @@
             // french e.g. "rogier", but exclude "hochmeier"
             if ((current == last)
                 && !slavo_germanic
-                && substring_equals(str, len, current - 2, 2, 1, "IE")
-                && !substring_equals(str, len, current - 4, 2, 2, "ME", "MA"))
+                && substring_equals(str, len, current - 2, 2, "IE", NULL)
+                && !substring_equals(str, len, current - 4, 2, "ME", "MA", NULL))
             {
                 char_array_append(secondary, "R");
             } else {
@@ -683,14 +681,14 @@
             continue;
         } else if (c == 'S') {
             // special cases "island", "isle", "carlisle", "carlysle"
-            if (substring_equals(str, len, current - 1, 3, 2, "ISL", "YSL")) {
+            if (substring_equals(str, len, current - 1, 3, "ISL", "YSL", NULL)) {
                 current++;
                 continue;
             }

             // special case "sugar-"
             if ((current == 0)
-                && substring_equals(str, len, current, 5, 1, "SUGAR"))
+                && substring_equals(str, len, current, 5, "SUGAR", NULL))
             {
                 char_array_append(primary, "X");
                 char_array_append(secondary, "S");
@@ -698,9 +696,9 @@
                 continue;
             }

-            if (substring_equals(str, len, current, 2, 1, "SH")) {
+            if (substring_equals(str, len, current, 2, "SH", NULL)) {
                 // Germanic
-                if (substring_equals(str, len, current + 1, 4, 4, "HEIM", "HOEK", "HOLM", "HOLZ")) {
+                if (substring_equals(str, len, current + 1, 4, "HEIM", "HOEK", "HOLM", "HOLZ", NULL)) {
                     char_array_append(primary, "S");
                     char_array_append(secondary, "S");
                 } else {
@@ -712,8 +710,8 @@
             }

             // Italian & Armenian
-            if (substring_equals(str, len, current, 3, 2, "SIO", "SIA")
-                || substring_equals(str, len, current, 4, 1, "SIAN"))
+            if (substring_equals(str, len, current, 3, "SIO", "SIA", NULL)
+                || substring_equals(str, len, current, 4, "SIAN", NULL))
             {
                 if (!slavo_germanic) {
                     char_array_append(primary, "S");
@@ -729,12 +727,12 @@
             /* German & Anglicisations, e.g. "Smith" match "Schmidt", "Snider" match "Schneider"
                also, -sz- in Slavic language although in Hungarian it is pronounced 's' */
             if (((current == 0)
-                 && substring_equals(str, len, current + 1, 1, 4, "M", "N", "L", "W"))
-                || substring_equals(str, len, current + 1, 1, 1, "Z"))
+                 && substring_equals(str, len, current + 1, 1, "M", "N", "L", "W", NULL))
+                || substring_equals(str, len, current + 1, 1, "Z", NULL))
             {
                 char_array_append(primary, "S");
                 char_array_append(secondary, "X");
-                if (substring_equals(str, len, current + 1, 1, 1, "Z")) {
+                if (substring_equals(str, len, current + 1, 1, "Z", NULL)) {
                     current += 2;
                 } else {
                     current++;
@@ -743,15 +741,15 @@
             }

-            if (substring_equals(str, len, current, 2, 1, "SC")) {
+            if (substring_equals(str, len, current, 2, "SC", NULL)) {
                 // Schlesinger's rule
                 if (get_char_at(str, len, current + 2) == 'H') {
                     // Dutch origin e.g. "school", "schooner"
-                    if (substring_equals(str, len, current + 3, 2, 6, "OO", "ER", "EN",
-                                         "UY", "ED", "EM"))
+                    if (substring_equals(str, len, current + 3, 2, "OO", "ER", "EN",
+                                         "UY", "ED", "EM", NULL))
                     {
                         // "Schermerhorn", "Schenker"
-                        if (substring_equals(str, len, current + 3, 2, 2, "ER", "EN")) {
+                        if (substring_equals(str, len, current + 3, 2, "ER", "EN", NULL)) {
                             char_array_append(primary, "X");
                             char_array_append(secondary, "SK");
                         } else {
@@ -774,7 +772,7 @@
                         continue;
                     }

-                    if (substring_equals(str, len, current + 2, 1, 3, "I", "E", "Y")) {
+                    if (substring_equals(str, len, current + 2, 1, "I", "E", "Y", NULL)) {
                         char_array_append(primary, "S");
                         char_array_append(secondary, "S");
                         current += 3;
@@ -790,7 +788,7 @@

             // French e.g. "resnais", "artois"
             if ((current == last)
-                && substring_equals(str, len, current - 2, 2, 2, "AI", "OI"))
+                && substring_equals(str, len, current - 2, 2, "AI", "OI", NULL))
             {
                 char_array_append(secondary, "S");
             } else {
@@ -798,7 +796,7 @@
                 char_array_append(secondary, "S");
             }

-            if (substring_equals(str, len, current + 1, 1, 2, "S", "Z")) {
+            if (substring_equals(str, len, current + 1, 1, "S", "Z", NULL)) {

                 current += 2;
             } else {
@@ -807,28 +805,28 @@
             continue;
         } else if (c == 'T') {

-            if (substring_equals(str, len, current, 4, 1, "TION")) {
+            if (substring_equals(str, len, current, 4, "TION", NULL)) {
                 char_array_append(primary, "X");
                 char_array_append(secondary, "X");
                 current += 3;
                 continue;
             }

-            if (substring_equals(str, len, current, 3, 2, "TIA", "TCH")) {
+            if (substring_equals(str, len, current, 3, "TIA", "TCH", NULL)) {
                 char_array_append(primary, "X");
                 char_array_append(secondary, "X");
                 current += 3;
                 continue;
             }

-            if (substring_equals(str, len, current, 2, 1, "TH")
-                || substring_equals(str, len, current, 3, 1, "TTH"))
+            if (substring_equals(str, len, current, 2, "TH", NULL)
+                || substring_equals(str, len, current, 3, "TTH", NULL))
             {
                 // special case "Thomas", "Thames", or Germanic
-                if (substring_equals(str, len, current + 2, 2, 2, "OM", "AM")
-                 || substring_equals(str, len, 0, 4, 2, "VAN ", "VON ")
-                 || substring_equals(str, len, current - 5, 5, 2, " VAN ", " VON ")
-                 || substring_equals(str, len, 0, 3, 1, "SCH"))
+                if (substring_equals(str, len, current + 2, 2, "OM", "AM", NULL)
+                 || substring_equals(str, len, 0, 4, "VAN ", "VON ", NULL)
+                 || substring_equals(str, len, current - 5, 5, " VAN ", " VON ", NULL)
+                 || substring_equals(str, len, 0, 3, "SCH", NULL))
                 {
                     char_array_append(primary, "T");
                     char_array_append(secondary, "T");
@@ -842,7 +840,7 @@
                 continue;
             }

-            if (substring_equals(str, len, current + 1, 1, 2, "T", "D")) {
+            if (substring_equals(str, len, current + 1, 1, "T", "D", NULL)) {
                 current += 2;
             } else {
                 current++;
@@ -863,7 +861,7 @@
             continue;
         } else if (c == 'W') {
             // can also be in the middle of word
-            if (substring_equals(str, len, current, 2, 1, "WR")) {
+            if (substring_equals(str, len, current, 2, "WR", NULL)) {
                 char_array_append(primary, "R");
                 char_array_append(secondary, "R");
                 current += 2;
@@ -872,7 +870,7 @@

             if ((current == 0)
                 && (is_vowel(get_char_at(str, len, current + 1))
-                || substring_equals(str, len, current, 2, 1, "WH")))
+                || substring_equals(str, len, current, 2, "WH", NULL)))
             {
                 // Wasserman should match Vasserman
                 if (is_vowel(get_char_at(str, len, current + 1))) {
@@ -887,9 +885,9 @@

             // Arnow should match Arnoff
             if (((current == last) && is_vowel(get_char_at(str, len, current - 1)))
-                || substring_equals(str, len, current - 1, 5, 4, "EWSKI", "EWSKY",
-                                    "OWSKI", "OWSKY")
-                || substring_equals(str, len, 0, 3, 1, "SCH"))
+                || substring_equals(str, len, current - 1, 5, "EWSKI", "EWSKY",
+                                    "OWSKI", "OWSKY", NULL)
+                || substring_equals(str, len, 0, 3, "SCH", NULL))
             {
                 char_array_append(secondary, "F");
                 current++;
@@ -897,7 +895,7 @@
             }

             // Polish e.g. "Filipowicz"
-            if (substring_equals(str, len, current, 4, 2, "WICZ", "WITZ")) {
+            if (substring_equals(str, len, current, 4, "WICZ", "WITZ", NULL)) {
                 char_array_append(primary, "TS");
                 char_array_append(secondary, "FX");
                 current += 4;
@@ -910,14 +908,14 @@
         } else if (c == 'X') {
             // French e.g. "breaux"
             if (!((current == last)
-                  && (substring_equals(str, len, current - 3, 3, 2, "IAU", "EAU")
-                   || substring_equals(str, len, current - 2, 2, 2, "AU", "OU"))))
+                  && (substring_equals(str, len, current - 3, 3, "IAU", "EAU", NULL)
+                   || substring_equals(str, len, current - 2, 2, "AU", "OU", NULL))))
             {
                 char_array_append(primary, "KS");
                 char_array_append(secondary, "KS");
             }

-            if (substring_equals(str, len, current + 1, 1, 2, "C", "X")) {
+            if (substring_equals(str, len, current + 1, 1, "C", "X", NULL)) {
                 current += 2;
             } else {
                 current++;
@@ -930,7 +928,7 @@
                 char_array_append(secondary, "J");
                 current += 2;
                 continue;
-            } else if (substring_equals(str, len, current + 1, 2, 3, "ZO", "ZI", "ZA")
+            } else if (substring_equals(str, len, current + 1, 2, "ZO", "ZI", "ZA", NULL)
                    || (slavo_germanic
                        && ((current > 0)
                        && get_char_at(str, len, current - 1) != 'T')))


Always provide a default for __USER_LABEL_PREFIX__

a) to match gcc & clang
b) So we can build lib/ for 32-bit targets


Cleanups

Cleanups

svn path=/trunk/; revision=17688

--- modules/printbackends/test/gtkprintbackendtest.c
+++ modules/printbackends/test/gtkprintbackendtest.c
@@ -458,7 +458,7 @@
   int i;

   /* make 100 of these printers */
-  for (i=0; i<100; i++)
+  for (i = 0; i < 100; i++)
     {
       char *name;
       name = g_strdup_printf ("%s %i", _("Print to Test Printer"), i);
@@ -574,13 +574,13 @@
   gint time;
   /* set the timer to succeed or fail at a random time interval */
   /* weight twords the shorter end */
-  weight = g_random_int_range(0, 100);
+  weight = g_random_int_range (0, 100);
   if (weight < 50)
-    time = g_random_int_range(0, 2);
+    time = g_random_int_range (0, 2);
   else if (weight < 75)
-    time = g_random_int_range(1, 5);
+    time = g_random_int_range (1, 5);
   else
-    time = g_random_int_range(1, 10);
+    time = g_random_int_range (1, 10);

   g_message ("Gathering details in %i seconds", time);

@@ -589,10 +589,7 @@
   else
     time *= 1000;

-  g_timeout_add(time,
-                (GSourceFunc) test_printer_details_aquired_cb,
-                printer
-               );
-}
-
-
+  g_timeout_add (time, (GSourceFunc) test_printer_details_aquired_cb, printer);
+}
+
+


Corrected mistake in sample code for xCoRoutineCreate().

--- Source/include/croutine.h
+++ Source/include/croutine.h
@@ -119,7 +119,7 @@
  // Variables in co-routines must be declared static if they must maintain value across a blocking call.
  // This may not be necessary for const variables.
  static const char cLedToFlash[ 2 ] = { 5, 6 };
- static const portTickType xTimeToDelay[ 2 ] = { 200, 400 };
+ static const portTickType uxFlashRates[ 2 ] = { 200, 400 };

      // Must start every co-routine with a call to crSTART();
      crSTART( xHandle );


fix override warnings

fix override warnings

--- src/Mod/PartDesign/Gui/TaskHoleParameters.h
+++ src/Mod/PartDesign/Gui/TaskHoleParameters.h
@@ -113,11 +113,11 @@
     };

 protected:
-    void changeEvent(QEvent *e);
+    void changeEvent(QEvent *e) override;
     void changedObject(const App::Property& Prop);

 private:
-    void onSelectionChanged(const Gui::SelectionChanges &msg);
+    void onSelectionChanged(const Gui::SelectionChanges &msg) override;

 private:


update test following the API change

update test following the API change

--- t/00unit/lib/common/string.c
+++ t/00unit/lib/common/string.c
@@ -347,12 +347,13 @@
 #define TEST(str, needle, ...) \
     do { \
         const char *expected[] = { __VA_ARGS__ }; \
-        h2o_iovec_vector_t ret = h2o_split(&pool, h2o_iovec_init(H2O_STRLIT((str))), (needle)); \
+        h2o_iovec_vector_t list = {0}; \
+        h2o_split(&pool, &list, h2o_iovec_init(H2O_STRLIT((str))), (needle)); \
         size_t expected_len = sizeof(expected) / sizeof(expected[0]); \
-        ok(expected_len == ret.size); \
+        ok(expected_len == list.size); \
         size_t i; \
-        for (i = 0; i != ret.size; ++i) { \
-            ok(h2o_memis(ret.entries[i].base, ret.entries[i].len, expected[i], strlen(expected[i]))); \
+        for (i = 0; i != list.size; ++i) { \
+            ok(h2o_memis(list.entries[i].base, list.entries[i].len, expected[i], strlen(expected[i]))); \
         } \
     } while (0);


better fix for mixer pointer

better fix for mixer pointer

SVN revision: 80918

--- src/modules/mixer/pa.c
+++ src/modules/mixer/pa.c
@@ -218,6 +218,7 @@
      {
         ecore_main_fd_handler_active_set(fdh, ECORE_FD_WRITE);
         pulse_tag_free(tag);
+        return (void*)1;
      }
    return tag;
 error:


Fix #109: Declare PID file path to dbus-daemon in dbus plugin

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- plugins/dbus.c
+++ plugins/dbus.c
@@ -58,7 +58,7 @@
 	erase("/var/run/dbus/pid");

 	/* Register service with Finit */
-	snprintf(line, sizeof(line), "[S12345] log:prio:daemon.info,tag:dbus %s %s -- %s", cmd, ARGS, DESC);
+	snprintf(line, sizeof(line), "[S12345] pid:!/run/dbus/pid log:prio:daemon.info,tag:dbus %s %s -- %s", cmd, ARGS, DESC);
 	if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
 		_pe("Failed registering %s", DAEMON);
 	free(cmd);


Correction des commentaires

Correction des commentaires

--- 3if/tp/tp-oo_1/src/CollectionEntiers.h
+++ 3if/tp/tp-oo_1/src/CollectionEntiers.h
@@ -34,10 +34,13 @@
     // Contrat : 'std::cout' doit exister et être accessible.

     void Ajouter (int valeur);
+    // <valeur> : valeur à ajouter dans CollectionEntiers
     // Mode d'emploi : Ajoute la valeur en paramètre à la collection.
     // Contrat : 'valeur' doit être un entier.

     void Retirer (unsigned int n, int retirer[]);
+    // <n> : taille de retirer
+    //<retirer[]> : tableau d'entiers à retirer de la collection
     // Mode d'emploi : Retire la liste de valeurs passée en paramètre de
     // la collection.
     // Contrat : 'n' doit spécifier la taille de 'retirer' ; 'retirer'
@@ -50,6 +53,7 @@
     // construite et initialisée.

     void Ajuster (unsigned int n);
+    // <n> : nouvelle taille de la collection
     // Mode d'emploi : Modifie la taille de la collection pour qu'elle
     // prenne la taille 'n'. 'n' peut être supérieur ou inférieur à la
     // taille actulle (auquel cas la collection sera tronguée à partir de
@@ -61,11 +65,14 @@
 //-------------------------------------------- Constructeurs - destructeur

     CollectionEntiers(unsigned int n);
+    // <n> : taille de la collection
     // Mode d'emploi : Construit une collection de taille 'n' sans valeurs
     // de départ (allocation seule).
     // Contrat : 'n' doit être un entier positif.

     CollectionEntiers(unsigned int n, int valeurs[]);
+    // <n> : taille du tableau de valeurs
+    // <valeurs[]> : tableau d'entiers
     // Mode d'emploi : Construit une collection de taille 'n' avec les
     // valeurs de départ du tableau 'valeurs'.
     // Contrat : 'n' doit spécifier la taille de 'valeurs' ; 'valeurs'
@@ -82,6 +89,7 @@
 //----------------------------------------------------- Méthodes protégées

     void Init(unsigned int n);
+    // <n> : taille initiale à allouer
     // Mode d'emploi : Initialise les valeurs de tous les attributs.
     // Contract : 'n' doit être un entier positif.


Model.h   - Add a model type field to indicate identification of children model.   - Change getter functions so they all return target pointer.

--- SubZero/src/model/Model.h
+++ SubZero/src/model/Model.h
@@ -14,6 +14,11 @@
 #include "HwInterface.h"
 #include "FilterManager.h"
 #include "FilterFactory.h"
+
+enum ModelType{
+	CameraModel = 1,
+	FPGAModel = 2
+};

 /**
  * This can have the potential to be an pure virtual (abstract) class, but it's not for now. Modle
@@ -32,6 +37,7 @@
 	Observable* state;
 	HwInterface* interface;
 	std::vector<FilterManager*> filterManagerList;
+	ModelType modelType;
 public:

 	/**
@@ -51,10 +57,9 @@

 	/**
 	 * getDataFromBuffer gets a Data pointer from HwInterface buffer. CreateData is called inside getDataFromBuffer.
-//	 * @param	DataDestination		an empty Data pointer that is filled up after running the function
-//   * @return						error message of the result of this function
+     * @return	shallow copy of the first Data* in HwInterface buffer
 	 */
-	virtual int getDataFromBuffer(Data* dataDestination)=0;
+	Data* getDataFromBuffer();

 	/**
 	 * sendCommand send a command to the FPGA


go back to smaller default buffer size (R.Preghenella)

--- TOF/AliTOFHitDataBuffer.h
+++ TOF/AliTOFHitDataBuffer.h
@@ -15,7 +15,7 @@
 #include "AliTOFHitData.h"

 //data buffer size
-#define DATA_BUFFER_SIZE 10000
+#define DATA_BUFFER_SIZE 1000

 class AliTOFHitDataBuffer : public TObject{


Fix wrong device in 03e378f (#150, again).

--- plugins/girs.c
+++ plugins/girs.c
@@ -161,7 +161,7 @@
 // understand this, just give some realistic default values.

 const struct driver hw_girs = {
-	.device		= "/dev/ACM0",
+	.device		= "/dev/ttyACM0",
 	.fd		= -1,
 	.features	= LIRC_CAN_REC_MODE2 | LIRC_CAN_SEND_PULSE,
 	.send_mode	= LIRC_MODE_PULSE,


separate free for data sens. structures

separate free for data sens. structures

--- src/cvodeData.c
+++ src/cvodeData.c
@@ -1,6 +1,6 @@
 /*
-  Last changed Time-stamp: <2006-10-02 17:16:43 raim>
-  $Id: cvodeData.c,v 1.10 2006/10/02 15:19:12 raimc Exp $
+  Last changed Time-stamp: <2006-10-02 17:40:33 raim>
+  $Id: cvodeData.c,v 1.11 2006/10/02 15:43:20 raimc Exp $
 */
 /*
  *
@@ -71,6 +71,7 @@
 				    odeModel_t *);
 static int CvodeData_initializeSensitivities(cvodeData_t *,cvodeSettings_t *,
 				    odeModel_t *);
+static void CvodeData_freeSensitivities(cvodeData_t *);
 /* static int CvodeData_allocateAdjSens(cvodeData_t *data, int neq); */

@@ -490,14 +491,7 @@
   if ( data->nsens != opt->nsens )
   {
     if ( data->sensitivity != NULL )
-    {
-      for ( i=0; i<data->neq; i++ )
-	free(data->sensitivity[i]);
-      free(data->sensitivity);
-      free(data->p);
-      free(data->p_orig);
-      data->p = data->p_orig = data->sensitivity = NULL;
-    }
+      CvodeData_freeSensitivities(data);
     if ( om->index_sens != NULL  ) /* redundant condition?? */
     {
       free(om->index_sens);
@@ -602,13 +596,11 @@

 /* frees all internal stuff of cvodeData */
-static void CvodeData_freeStructures(cvodeData_t * data)
+static void CvodeData_freeSensitivities(cvodeData_t * data)
 {
   int i;

-  if ( data == NULL ) return;
-
-  /* free sensitivity structure */
+  /* free forward sensitivity */
   if ( data->sensitivity != NULL )
   {
     for ( i=0; i<data->neq; i++ )
@@ -618,11 +610,23 @@
   if ( data->p != NULL ) free(data->p);
   if ( data->p_orig != NULL ) free(data->p_orig);

-  /* free adjoint structure*/
-  if ( data->adjvalue != NULL )
-    free(data->adjvalue );
-
-
+  data->p = data->p_orig = NULL;
+  data->sensitivity = NULL;
+}
+
+/* frees all internal stuff of cvodeData */
+static void CvodeData_freeStructures(cvodeData_t * data)
+{
+  int i;
+
+  if ( data == NULL ) return;
+
+  /* free sensitivity structure */
+  CvodeData_freeSensitivities(data);
+
+  /* free adjoint sensitivity */
+  if ( data->adjvalue != NULL ) free(data->adjvalue );
+
   /* free results structure */
   CvodeResults_free(data->results);


Fix two bugs -

Fix two bugs -

First, treat the return from read() as an int instead of an ssize_t.
The latter is the official return type of read, but it's unsigned,
so when read() returns a -1 on error, it looks like a huge positive
number. Stupid. Whose fault is this? POSIX's?

Second, make sure we never try to read on the listen socket.

The result of these two bugs was that I was reading from the listen
socket, and it was failing and returning -1, but that looked like
a successful read.

--- pelab/libnetmon/netmond.c
+++ pelab/libnetmon/netmond.c
@@ -102,18 +102,18 @@
         /*
          * Now, check to see if any clients have sent us any data
          */
-        for (i = sockfd; i <= max_clientfd; i++) {
+        for (i = sockfd + 1; i <= max_clientfd; i++) {
             if (FD_ISSET(i,&returned_fdset)) {
                 char *buf[1024];
                 size_t bufsize = 1024;
-                size_t read_bytes;
+                int read_bytes;

                 read_bytes = read(i,buf,bufsize);

                 if (read_bytes >= 1) {
                     /*
-                     * Okay, this client had data for us, let's copy that back out
-                     * to stdout
+                     * Okay, this client had data for us, let's copy that back
+                     * out to stdout
                      */
                     write(1,buf,read_bytes);
                 } else {


bug 1961 - don't exit() on invalid json

bug 1961 - don't exit() on invalid json

Change-Id: I00ee3c9fa783a002959cec79b19f0b52a0da0a8f
Reviewed-on: http://review.northscale.com/1720
Reviewed-by: Aliaksey Kandratsenka <340b8e09ca65cd3fc686427fcfed17e87eaf61e2@gmail.com>
Tested-by: Aliaksey Kandratsenka <340b8e09ca65cd3fc686427fcfed17e87eaf61e2@gmail.com>

--- agent_config.c
+++ agent_config.c
@@ -568,7 +568,10 @@
             if (ml->log_mode != ERRORLOG_STDERR) {
                 fprintf(stderr, "ERROR: bad JSON configuration: %s\n", config);
             }
-            exit(EXIT_FAILURE);
+
+            // Bug 1961 - don't exit() as we might be in a multitenant use case.
+            //
+            // exit(EXIT_FAILURE);
         }
     } else {
         if (settings.verbose > 1) {


Poprawiona deklaracja aghContainer

Poprawiona deklaracja aghContainer

--- aghContainer.h
+++ aghContainer.h
@@ -91,7 +91,7 @@
      * @param start index (default = 0)
      * @return int index
      */
-    virtual int indexOf(const T &_value, int _from = 0) const;
+    virtual int indexOf(const T &_value, int _from = 0) const = 0;

     /**
      * Check if element exists in container within specified range.
@@ -100,7 +100,7 @@
      * @param start index (default = 0)
      * @return bool
      */
-    virtual bool contains(const T &_value, int _from = 0) const = 0;
+    virtual bool contains(const T &_value, int _from = 0) const;

     /**
      * Print elements of container to output.


* minor indent fix in SGMatrix

* minor indent fix in SGMatrix

--- src/shogun/lib/SGMatrix.h
+++ src/shogun/lib/SGMatrix.h
@@ -60,14 +60,14 @@
 			return &matrix[col*num_rows];
 		}

-        /** operator overload for matrix read only access
-         * @param i_row
-         * @param i_col
-         */
-        inline const T& operator()(index_t i_row, index_t i_col) const
-        {
-            return matrix[i_col*num_rows + i_row];
-        }
+		/** operator overload for matrix read only access
+		 * @param i_row
+		 * @param i_col
+		 */
+		inline const T& operator()(index_t i_row, index_t i_col) const
+		{
+		    return matrix[i_col*num_rows + i_row];
+		}

 		/** operator overload for matrix read only access
 		 * @param index to access
@@ -77,14 +77,14 @@
 			return matrix[index];
 		}

-        /** operator overload for matrix r/w access
-         * @param i_row
-         * @param i_col
-         */
-        inline T& operator()(index_t i_row, index_t i_col)
-        {
-            return matrix[i_col*num_rows + i_row];
-        }
+		/** operator overload for matrix r/w access
+		 * @param i_row
+		 * @param i_col
+		 */
+		inline T& operator()(index_t i_row, index_t i_col)
+		{
+		    return matrix[i_col*num_rows + i_row];
+		}

 		/** operator overload for matrix r/w access
 		 * @param index to access


add Synchronized

add Synchronized

--- eventrpc/eventrpc/monitor.h
+++ eventrpc/eventrpc/monitor.h
@@ -33,6 +33,20 @@
   DISALLOW_EVIL_CONSTRUCTOR(Monitor);
 };

+class Synchronized {
+ public:
+  Synchronized(const Monitor& value)
+    : monitor_(value) {
+      monitor_.Lock();
+  }
+
+  ~Synchronized() {
+    monitor_.Unlock();
+  }
+
+ private:
+  const Monitor& monitor_;
+};
 };

 #endif  //  __EVENTRPC_MONITOR_H__


isl_dim_map: allow signed mapping

isl_dim_map: allow signed mapping

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- isl_dim_map.c
+++ isl_dim_map.c
@@ -15,10 +15,15 @@
 #include <isl_dim_map.h>
 #include <isl_reordering.h>

+struct isl_dim_map_entry {
+	int pos;
+	int sgn;
+};
+
 /* Maps dst positions to src positions */
 struct isl_dim_map {
 	unsigned len;
-	int pos[1];
+	struct isl_dim_map_entry m[1];
 };

 __isl_give isl_dim_map *isl_dim_map_alloc(isl_ctx *ctx, unsigned len)
@@ -26,13 +31,14 @@
 	int i;
 	struct isl_dim_map *dim_map;
 	dim_map = isl_alloc(ctx, struct isl_dim_map,
-				sizeof(struct isl_dim_map) + len * sizeof(int));
+	    sizeof(struct isl_dim_map) + len * sizeof(struct isl_dim_map_entry));
 	if (!dim_map)
 		return NULL;
 	dim_map->len = 1 + len;
-	dim_map->pos[0] = 0;
+	dim_map->m[0].pos = 0;
+	dim_map->m[0].sgn = 1;
 	for (i = 0; i < len; ++i)
-		dim_map->pos[1 + i] = -1;
+		dim_map->m[1 + i].sgn = 0;
 	return dim_map;
 }

@@ -47,8 +53,10 @@
 		return;

 	src_pos = 1 + isl_dim_offset(dim, type);
-	for (i = 0; i < n; ++i)
-		dim_map->pos[1 + dst_pos + i] = src_pos + first + i;
+	for (i = 0; i < n; ++i) {
+		dim_map->m[1 + dst_pos + i].pos = src_pos + first + i;
+		dim_map->m[1 + dst_pos + i].sgn = 1;
+	}
 }

 void isl_dim_map_dim(__isl_keep isl_dim_map *dim_map, __isl_keep isl_dim *dim,
@@ -68,8 +76,10 @@
 		return;

 	src_pos = 1 + isl_dim_total(bmap->dim);
-	for (i = 0; i < bmap->n_div; ++i)
-		dim_map->pos[1 + dst_pos + i] = src_pos + i;
+	for (i = 0; i < bmap->n_div; ++i) {
+		dim_map->m[1 + dst_pos + i].pos = src_pos + i;
+		dim_map->m[1 + dst_pos + i].sgn = 1;
+	}
 }

 void isl_dim_map_dump(struct isl_dim_map *dim_map)
@@ -77,7 +87,8 @@
 	int i;

 	for (i = 0; i < dim_map->len; ++i)
-		fprintf(stderr, "%d -> %d; ", i, dim_map->pos[i]);
+		fprintf(stderr, "%d -> %d * %d; ", i,
+			dim_map->m[i].sgn, dim_map->m[i].pos);
 	fprintf(stderr, "\n");
 }

@@ -87,10 +98,12 @@
 	int i;

 	for (i = 0; i < dim_map->len; ++i) {
-		if (dim_map->pos[i] < 0)
+		if (dim_map->m[i].sgn == 0)
 			isl_int_set_si(dst[i], 0);
+		else if (dim_map->m[i].sgn > 0)
+			isl_int_set(dst[i], src[dim_map->m[i].pos]);
 		else
-			isl_int_set(dst[i], src[dim_map->pos[i]]);
+			isl_int_neg(dst[i], src[dim_map->m[i].pos]);
 	}
 }

@@ -158,9 +171,11 @@
 		return NULL;

 	for (i = 0; i < dim_map->len; ++i)
-		res->pos[i] = dim_map->pos[i];
-	for (i = 0; i < bmap->n_div; ++i)
-		res->pos[dim_map->len + i] = offset + i;
+		res->m[i] = dim_map->m[i];
+	for (i = 0; i < bmap->n_div; ++i) {
+		res->m[dim_map->len + i].pos = offset + i;
+		res->m[dim_map->len + i].sgn = 1;
+	}

 	return res;
 }
@@ -184,8 +199,10 @@
 	if (!dim_map)
 		return NULL;

-	for (i = 0; i < exp->len; ++i)
-		dim_map->pos[1 + exp->pos[i]] = 1 + i;
+	for (i = 0; i < exp->len; ++i) {
+		dim_map->m[1 + exp->pos[i]].pos = 1 + i;
+		dim_map->m[1 + exp->pos[i]].sgn = 1;
+	}

 	return dim_map;
 }


isl_basic_map_lexmin: turn off equality detection on non-parametric problems

Detecting equalities can be quite expensive and has mostly been shown
effective on parametric problems.  For non-parametric problems, we
are effectively computing several solutions as a preprocessing step
to computing a single solution, albeit a special one.
Until we obtain more evidence that this is useful,
it seems prudent to turn off this equality detection on non-parametric
problems.

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- isl_tab_pip.c
+++ isl_tab_pip.c
@@ -4432,6 +4432,9 @@
 	isl_assert(bmap->ctx,
 	    isl_basic_map_compatible_domain(bmap, dom), goto error);

+	if (isl_basic_set_dim(dom, isl_dim_all) == 0)
+		return basic_map_partial_lexopt(bmap, dom, empty, max);
+
 	bmap = isl_basic_map_intersect_domain(bmap, isl_basic_set_copy(dom));
 	bmap = isl_basic_map_detect_equalities(bmap);
 	bmap = isl_basic_map_remove_redundancies(bmap);


isl_tab_pip.c: find_context_div: reserve negative return value for failures

In particular, if no suitable integer division can be found, then
return a position beyond the integer divisions instead of a negative value.

Signed-off-by: Sven Verdoolaege <235c10dd23b819f81cdc9756a251746bc184cab6@gmail.com>

--- isl_tab_pip.c
+++ isl_tab_pip.c
@@ -4282,30 +4282,36 @@

 /* Check if integer division "div" of "dom" also occurs in "bmap".
  * If so, return its position within the divs.
- * If not, return -1.
+ * Otherwise, return a position beyond the integer divisions.
  */
 static int find_context_div(__isl_keep isl_basic_map *bmap,
 	__isl_keep isl_basic_set *dom, unsigned div)
 {
 	int i;
-	unsigned b_dim = isl_space_dim(bmap->dim, isl_dim_all);
-	unsigned d_dim = isl_space_dim(dom->dim, isl_dim_all);
+	unsigned b_dim, d_dim, n_div;
+
+	if (!bmap || !dom)
+		return -1;
+
+	b_dim = isl_space_dim(bmap->dim, isl_dim_all);
+	d_dim = isl_space_dim(dom->dim, isl_dim_all);
+	n_div = isl_basic_map_dim(bmap, isl_dim_div);

 	if (isl_int_is_zero(dom->div[div][0]))
-		return -1;
+		return n_div;
 	if (isl_seq_first_non_zero(dom->div[div] + 2 + d_dim, dom->n_div) != -1)
-		return -1;
-
-	for (i = 0; i < bmap->n_div; ++i) {
+		return n_div;
+
+	for (i = 0; i < n_div; ++i) {
 		if (isl_int_is_zero(bmap->div[i][0]))
 			continue;
 		if (isl_seq_first_non_zero(bmap->div[i] + 2 + d_dim,
-					   (b_dim - d_dim) + bmap->n_div) != -1)
+					   (b_dim - d_dim) + n_div) != -1)
 			continue;
 		if (isl_seq_eq(bmap->div[i], dom->div[div], 2 + d_dim))
 			return i;
 	}
-	return -1;
+	return n_div;
 }

 /* The correspondence between the variables in the main tableau,
@@ -4328,11 +4334,20 @@
 	int i;
 	int common = 0;
 	int other;
-
-	for (i = 0; i < dom->n_div; ++i)
-		if (find_context_div(bmap, dom, i) != -1)
+	unsigned bmap_n_div;
+
+	bmap_n_div = isl_basic_map_dim(bmap, isl_dim_div);
+
+	for (i = 0; i < dom->n_div; ++i) {
+		int pos;
+
+		pos = find_context_div(bmap, dom, i);
+		if (pos < 0)
+			return isl_basic_map_free(bmap);
+		if (pos < bmap_n_div)
 			common++;
-	other = bmap->n_div - common;
+	}
+	other = bmap_n_div - common;
 	if (dom->n_div - common > 0) {
 		bmap = isl_basic_map_extend_space(bmap, isl_space_copy(bmap->dim),
 				dom->n_div - common, 0, 0);
@@ -4341,16 +4356,17 @@
 	}
 	for (i = 0; i < dom->n_div; ++i) {
 		int pos = find_context_div(bmap, dom, i);
-		if (pos < 0) {
+		if (pos < 0)
+			bmap = isl_basic_map_free(bmap);
+		if (pos >= bmap_n_div) {
 			pos = isl_basic_map_alloc_div(bmap);
 			if (pos < 0)
 				goto error;
 			isl_int_set_si(bmap->div[pos][0], 0);
+			bmap_n_div++;
 		}
 		if (pos != other + i)
 			bmap = isl_basic_map_swap_div(bmap, pos, other + i);
-		if (!bmap)
-			return NULL;
 	}
 	return bmap;
 error:


Remove the left-over swac.h from the plugin root dir


remove superfluous sensor_attach() added for debug reasons

--- dev/isa/asmc.c
+++ dev/isa/asmc.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: asmc.c,v 1.2 2015/10/01 15:57:08 jsg Exp $	*/
+/*	$OpenBSD: asmc.c,v 1.3 2015/10/01 18:24:28 jung Exp $	*/
 /*
  * Copyright (c) 2015 Joerg Jung <jung@openbsd.org>
  *
@@ -451,7 +451,6 @@
 		sc->sc_sensor_fan[i].flags &= ~SENSOR_FINVALID;
 		sensor_attach(&sc->sc_sensor_dev, &sc->sc_sensor_fan[i]);
 	}
-	sensor_attach(&sc->sc_sensor_dev, &sc->sc_sensor_fan[3]);
 	return 0;
 }


MaxAudioGraph.h: updated header documentation as per request from Trond

--- implementations/MaxMSP/MaxAudioGraph.h
+++ implementations/MaxMSP/MaxAudioGraph.h
@@ -129,12 +129,13 @@
 TTErr wrapAsMaxAudioGraph(TTSymbolPtr ttblueClassName, char* maxClassName, MaxAudioGraphWrappedClassPtr* c, TTValidityCheckFunction validityCheck, MaxAudioGraphWrappedClassOptionsPtr options);

 /**
- This version can be passed a method that is called to make sure it is legit to instantiate the class.
- * @param ttClassName           Name of the Jamoma DSP class that will be wrapped.
+ This version can be passed a method that is called to make sure it is okay to instantiate the class.
+ This is useful, for example, if you need to have copy-protection for your external.
+ * @param ttClassName           Name of the Jamoma Audio Graph class that will be wrapped.
  * @param maxClassName          Name of the resulting Max external.
- * @param c                     Pointer to the wrapped class.
- * @param validityCheck
- * @param validityCheckArgument
+ * @param c                     Address to a variable to hold the wrapped Max class upon return.
+ * @param validityCheck			Pointer to a function that will return a true or false regarding whether or not it is okay to instantiate the object.
+ * @param validityCheckArgument	An argument that will be passed to the validity check function, or NULL if you don't wish to pass an argument.
  * @param options               Pointer to additional options that will be forwarded to the wrapped object when instantiated.
  */
 TTErr wrapAsMaxAudioGraph(TTSymbolPtr ttblueClassName, char* maxClassName, MaxAudioGraphWrappedClassPtr* c, TTValidityCheckFunction validityCheck, TTPtr validityCheckArgument, MaxAudioGraphWrappedClassOptionsPtr options);
@@ -143,23 +144,23 @@

 /**
  Method called when a connection from an upstream node is dropped
- * @param self                  This object.
+ * @param self                  This Max object.
  * @param inletNumber           The inlet of this object who is now loosing a connection.
  * @param sourceMaxObject       The upstream (source) object who is now disconnecting.
- * @param sourceOutletNumber    The outlet of the source obejct that is now being disconnected.
+ * @param sourceOutletNumber    The outlet of the source object that is now being disconnected.
  */
 TTErr MaxAudioGraphDrop(ObjectPtr self, long inletNumber, ObjectPtr sourceMaxObject, long sourceOutletNumber);

 /**
- What do this one do?
- * @param self                      This object.
- * @param returnedAudioGraphObject
+ Returns a pointer to the Jamoma Audio Graph object that is wrapped by this Max object.
+ * @param self                      This Max object.
+ * @param returnedAudioGraphObject	Pointer to the wrapped Jamoma Audio Graph object.
  */
 TTErr MaxAudioGraphObject(ObjectPtr self, TTAudioGraphObjectPtr* returnedAudioGraphObject);

 /**
  Method called when an upstream node is connected to this node
- * @param x
+ * @param x						This Max object.
  * @param audioSourceObject     The upstream object/node that is now connecting
  * @param sourceOutletNumber    What outlet of the upstream object that is now connecting to this object
  */
@@ -167,14 +168,14 @@

 /**
  Clear the list of source objects from which this object will try to pull audio
- * @param x
+ * @param x				This Max object.
  * @param vectorSize    Initial vector size, might be overruled by subsequent process calls.
  */
 TTErr MaxAudioGraphReset(ObjectPtr x, long vectorSize);

 /**
  Set up fresh connections from this object to nodes that are connected downstream
- * @param self          This object
+ * @param self          This Max object.
  */
 TTErr MaxAudioGraphSetup(ObjectPtr self);


update format

update format

--- everybit/bitarray.c
+++ everybit/bitarray.c
@@ -188,41 +188,54 @@

   // Convert a rotate left or right to a left rotate only, and eliminate
   // multiple full rotations.
+
+  // The amount of left rotation
+  int d = modulo(-bit_right_amount, bit_length);
+
+  // If we are rotating by 0 slots then just stop
+  if (d == 0) {
+    return;
+  }
+
+  // Initialize rotation variables
+  // i indicates the number of bits we still need to swap from the left side
+  int i = d;
+  // j indicates the number of bits we still need to swap from the right side
+  int j = bit_length - d;
+
+  while (i != j) {
+    if (i < j) {
+      // Left part is bigger than the right part, swap left to its final position
+      // in the right side
+      // e.g: A[0..7] left-rotate by 3; swap A[0..2] with A[5..7]
+      swap(bitarray, bit_offset + d - i, bit_offset + d + j - i, i);
+      j -= i;
+    } else {
+      // right part is bigger than the left part, swap right to its final position
+      // in the left side
+      // e.g: A[0..7] left-rotate by 3; swap A[0..2] with A[5..7]
+      swap(bitarray, bit_offset + d - i, bit_offset + d, j);
+      i -= j;
+    }
+  }
+
+  // Left part and right part are of the same size, we just swap them directly
+  // e.g: A[0..7] left-rotate by 4; swap A[0..3] with A[4..7]
+  swap(bitarray, bit_offset + d - i, bit_offset + d, i);
+
   /*bitarray_rotate_left(bitarray, bit_offset, bit_length,
            modulo(-bit_right_amount, bit_length));*/
-
-	//which value will be in zero slot (at bit_offset)
-	int d = modulo(-bit_right_amount, bit_length);
-
-	//if we are rotating 0 slots then just stop
-	if(d == 0){
-		return;
-	}
-
-	//initialize rotation variables
-	int i = d;
-	int j = bit_length - d ;
-
-	while(i!=j){
-
-		if(i<j){
-			swap(bitarray, bit_offset+d-i,bit_offset+d+j-i,i);
-			j-=i;
-		}else{
-			swap(bitarray,bit_offset+d-i,bit_offset+d,j);
-			i-=j;
-		}
-	}
-	swap(bitarray,bit_offset+d-i,bit_offset+d,i);
-	/*bitarray_rotate_left(bitarray, bit_offset, bit_length,
-           modulo(-bit_right_amount, bit_length));*/
-}
-void swap(bitarray_t * const bitarray, int start_left, int start_right, int length){
-	for (int i = 0; i < length; i++){
-		bool current_left = bitarray_get(bitarray,start_left + i);
-		bitarray_set(bitarray,start_left + i, bitarray_get(bitarray,start_right + i));
-		bitarray_set(bitarray,start_right + i,current_left);
-	}
+}
+
+
+// Swap the bit elements of bitarray[start_left...start_left + length + 1] with
+// the bit elements of bitarray[start_right...start_right + length - 1]
+void swap(bitarray_t * const bitarray, int start_left, int start_right, int length) {
+  for (int i = 0; i < length; i++){
+    bool current_left = bitarray_get(bitarray,start_left + i);
+    bitarray_set(bitarray,start_left + i, bitarray_get(bitarray,start_right + i));
+    bitarray_set(bitarray,start_right + i,current_left);
+  }
 }

 static void bitarray_rotate_left(bitarray_t *const bitarray,


Add H_GETTIMEOFDAY

Add H_GETTIMEOFDAY

--- evpp/gettimeofday.h
+++ evpp/gettimeofday.h
@@ -12,68 +12,8 @@

 #ifdef WIN32

-//thrift-0.8.0 implementation
-#if 0
-
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
-#   define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
-#else
-#   define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
-#endif
-
-struct timezone {
-    int  tz_minuteswest; /* minutes W of Greenwich */
-    int  tz_dsttime;     /* type of dst correction */
-};
-
-inline int gettimeofday(struct timeval* tv, struct timezone* tz) {
-    FILETIME         ft;
-    unsigned __int64 tmpres(0);
-    static int       tzflag;
-
-    if (NULL != tv) {
-        GetSystemTimeAsFileTime(&ft);
-
-        tmpres |= ft.dwHighDateTime;
-        tmpres <<= 32;
-        tmpres |= ft.dwLowDateTime;
-
-        /*converting file time to unix epoch*/
-        tmpres -= DELTA_EPOCH_IN_MICROSECS;
-        tmpres /= 10;  /*convert into microseconds*/
-        tv->tv_sec = (long)(tmpres / 1000000UL);
-        tv->tv_usec = (long)(tmpres % 1000000UL);
-    }
-
-    if (NULL != tz) {
-        if (!tzflag) {
-            _tzset();
-            tzflag++;
-        }
-
-        long time_zone(0);
-        errno_t err(_get_timezone(&time_zone));
-
-        if (err == NO_ERROR) {
-            tz->tz_minuteswest = time_zone / 60;
-        } else {
-            return -1;
-        }
-
-        int day_light(0);
-        err = (_get_daylight(&day_light));
-
-        if (err == NO_ERROR) {
-            tz->tz_dsttime = day_light;
-            return 0;
-        } else {
-            return -1;
-        }
-    }
-
-    return -1;
-}
-#else
+#ifndef H_GETTIMEOFDAY
+#define H_GETTIMEOFDAY
 inline int gettimeofday(struct timeval* tp, void* tzp) {
     time_t clock;
     struct tm tm;
@@ -91,7 +31,7 @@
     tp->tv_usec = wtm.wMilliseconds * 1000;
     return (0);
 }
-#endif
+#endif // end of H_GETTIMEOFDAY

 #endif //end of WIN32


perl: add XS_VERSION_BOOTCHECK for safety

--- perl/xs-src/MessagePack.c
+++ perl/xs-src/MessagePack.c
@@ -21,7 +21,7 @@

 XS(boot_Data__MessagePack) {
     dXSARGS;
-    PERL_UNUSED_VAR(items);
+    XS_VERSION_BOOTCHECK;

     init_Data__MessagePack_pack(aTHX_   false);
     init_Data__MessagePack_unpack(aTHX_ false);


start implementing the bits that allocate the per port structures and their ccb lists. this is missing handling of the dmamem each port needs to manage, but that can wait till i figure out how it fits together. insane stuff.

--- dev/pci/ahci.c
+++ dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.26 2006/12/12 02:24:20 dlg Exp $ */
+/*	$OpenBSD: ahci.c,v 1.27 2006/12/12 02:37:09 dlg Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -223,6 +223,8 @@
 			    struct pci_attach_args *);
 void			ahci_unmap_intr(struct ahci_softc *,
 			    struct pci_attach_args *);
+int			ahci_port_alloc(struct ahci_softc *, u_int);
+void			ahci_port_free(struct ahci_softc *, u_int);

 struct ahci_ccb		*ahci_get_ccb(struct ahci_port *);
 void			ahci_put_ccb(struct ahci_port *, struct ahci_ccb *);
@@ -401,6 +403,92 @@
 }

 int
+ahci_port_alloc(struct ahci_softc *sc, u_int port)
+{
+	struct ahci_port		*ap;
+	struct ahci_ccb			*ccb;
+	int				i;
+
+	ap = malloc(sizeof(struct ahci_port), M_DEVBUF, M_NOWAIT);
+	if (ap == NULL) {
+		printf("%s: unable to allocate memory for port %d\n",
+		    DEVNAME(sc), port);
+		return (1);
+	}
+	bzero(ap, sizeof(struct ahci_port));
+
+	ap->ap_sc = sc;
+	TAILQ_INIT(&ap->ap_ccb_free);
+
+	ap->ap_ccbs = malloc(sizeof(struct ahci_ccb) * sc->sc_ncmds, M_DEVBUF,
+	    M_NOWAIT);
+	if (ap->ap_ccbs == NULL) {
+		printf("%s: unable to allocate command list for port %d\n",
+		    DEVNAME(sc), port);
+		goto freeport;
+	}
+	bzero(ap->ap_ccbs, sizeof(struct ahci_ccb) * sc->sc_ncmds);
+
+	if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
+	    AHCI_PORT_REGION(i), AHCI_PORT_SIZE, &ap->ap_ioh) != 0) {
+		printf("%s: unable to create register window for port %d\n",
+		    DEVNAME(sc), port);
+		goto freeccbs;
+	}
+
+	/* XXX alloc dma mem */
+
+	for (i = 0; i < sc->sc_ncmds; i++) {
+		ccb = &ap->ap_ccbs[i];
+
+		if (bus_dmamap_create(sc->sc_dmat, MAXPHYS, AHCI_MAX_PRDT,
+		    MAXPHYS, 0, 0, &ccb->ccb_dmamap) != 0) {
+			printf("unable to create dmamap for port %d ccb %d\n",
+			    DEVNAME(sc), port, i);
+			goto freemaps;
+		}
+
+		/* XXX point ccb at its cmd structures in dma mem */
+
+		ahci_put_ccb(ap, ccb);
+	}
+
+	return (0);
+
+freemaps:
+	while ((ccb = ahci_get_ccb(ap)) != NULL)
+		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmamap);
+	/* XXX free dma mem */
+freeccbs:
+	free(ap->ap_ccbs, M_DEVBUF);
+freeport:
+	free(ap, M_DEVBUF);
+	return (1);
+}
+
+void
+ahci_port_free(struct ahci_softc *sc, u_int port)
+{
+	struct ahci_port		*ap;
+	struct ahci_ccb			*ccb;
+	int				i;
+
+	ap = sc->sc_ports[i];
+
+	for (i = 0; i < sc->sc_ncmds; i++) {
+		ccb = &ap->ap_ccbs[i];
+
+		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmamap);
+	}
+
+	/* XXX free dma mem */
+	/* bus_space(9) says we dont free the subregions handle */
+	free(ap->ap_ccbs, M_DEVBUF);
+	free(ap, M_DEVBUF);
+	sc->sc_ports[i] = NULL;
+}
+
+int
 ahci_intr(void *arg)
 {
 	return (0);


%b format string for the GHC register. less whitespace while here

--- dev/pci/ahci.c
+++ dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.39 2007/02/06 04:44:01 dlg Exp $ */
+/*	$OpenBSD: ahci.c,v 1.40 2007/02/14 04:36:53 dlg Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -67,18 +67,17 @@
 #define  AHCI_REG_CAP_SSNTF		(1<<29) /* SNotification Register */
 #define  AHCI_REG_CAP_SNCQ		(1<<30) /* Native Cmd Queuing */
 #define  AHCI_REG_CAP_S64A		(1<<31) /* 64bit Addressing */
-
 #define  AHCI_FMT_CAP		"\020" "\006SXS" "\007EMS" "\010CCCS" \
 				    "\016PSC" "\017SSC" "\020PMD" "\021FBSS" \
 				    "\022SPM" "\023SAM" "\024SNZO" "\031SCLO" \
 				    "\032SAL" "\033SALP" "\034SSS" "\035SMPS" \
 				    "\036SSNTF" "\037NCQ" "\040S64A"
-
 #define AHCI_REG_GHC		0x004 /* Global HBA Control */
 #define  AHCI_REG_GHC_HR		(1<<0) /* HBA Reset */
 #define  AHCI_REG_GHC_IE		(1<<1) /* Interrupt Enable */
 #define  AHCI_REG_GHC_MRSM		(1<<2) /* MSI Revert to Single Msg */
 #define  AHCI_REG_GHC_AE		(1<<31) /* AHCI Enable */
+#define AHCI_FMT_GHC		"\020" "\001HR" "\002IE" "\003MRSM" "\040AE"
 #define AHCI_REG_IS		0x008 /* Interrupt Status */
 #define AHCI_REG_PI		0x00c /* Ports Implemented */
 #define AHCI_REG_VS		0x010 /* AHCI Version */
@@ -168,13 +167,11 @@
 #define  AHCI_PREG_CMD_ICC_PARTIAL	0x20000000
 #define  AHCI_PREG_CMD_ICC_ACTIVE	0x10000000
 #define  AHCI_PREG_CMD_ICC_IDLE		0x00000000
-
 #define  AHCI_PFMT_CMD		"\020" "\001ST" "\002SUD" "\003POD" \
 				    "\004CLO" "\005FRE" "\016MPSS" "\017FR" \
 				    "\020CR" "\021CPS" "\022PMA" "\023HPCP" \
 				    "\024MPSP" "\025CPD" "\026ESP" \
 				    "\031ATAPI" "\032DLAE" "\033ALPE" "\034ASP"
-
 #define AHCI_PREG_TFD		0x20 /* Task File Data*/
 #define  AHCI_PREG_TFD_STS		0xff
 #define  AHCI_PREG_TFD_STS_ERR		(1<<0)


only reset the controller if it is already enabled.

--- dev/pci/ahci.c
+++ dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.40 2007/02/14 04:36:53 dlg Exp $ */
+/*	$OpenBSD: ahci.c,v 1.41 2007/02/17 05:39:15 dlg Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -520,12 +520,17 @@
 	u_int32_t			reg;
 	const char			*revision;

-	/* reset the controller */
-	ahci_write(sc, AHCI_REG_GHC, AHCI_REG_GHC_HR);
-	if (ahci_wait_ne(sc, AHCI_REG_GHC, AHCI_REG_GHC_HR,
-	    AHCI_REG_GHC_HR) != 0) {
-		printf(": unable to reset controller\n");
-		return (1);
+	DPRINTF(AHCI_D_VERBOSE, " GHC 0x%b", ahci_read(sc, AHCI_REG_GHC),
+	    AHCI_FMT_GHC);
+
+	if (ISSET(AHCI_REG_GHC_AE, ahci_read(sc, AHCI_REG_GHC))) {
+		/* reset the controller */
+		ahci_write(sc, AHCI_REG_GHC, AHCI_REG_GHC_HR);
+		if (ahci_wait_ne(sc, AHCI_REG_GHC, AHCI_REG_GHC_HR,
+		    AHCI_REG_GHC_HR) != 0) {
+			printf(": unable to reset controller\n");
+			return (1);
+		}
 	}

 	/* enable ahci */


rename ccb_id to ccb_slot so its more clear what its used for. stash a pointer to the port and the ata_xfer in there too.

--- dev/pci/ahci.c
+++ dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ahci.c,v 1.45 2007/02/20 22:27:59 dlg Exp $ */
+/*	$OpenBSD: ahci.c,v 1.46 2007/02/20 22:33:37 dlg Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -314,9 +314,13 @@
 #define AHCI_DMA_KVA(_adm)	((void *)(_adm)->adm_kva)

 struct ahci_softc;
+struct ahci_port;

 struct ahci_ccb {
-	int			ccb_id;
+	int			ccb_slot;
+	struct ahci_port	*ccb_port;
+
+	struct ata_xfer		*ccb_xa;

 	struct ahci_cmd		*ccb_cmd;
 	u_int64_t		ccb_cmd_dva;
@@ -655,7 +659,8 @@
 			goto freemaps;
 		}

-		ccb->ccb_id = i;
+		ccb->ccb_slot = i;
+		ccb->ccb_port = ap;
 		ccb->ccb_cmd = (struct ahci_cmd *)(kva + offset);
 		ccb->ccb_cmd_dva = dva + offset;
 		offset += sizeof(struct ahci_cmd);


Move offline state up in priority over degraded. Various cleanups in state functions.

--- dev/softraid.c
+++ dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.13 2007/03/31 12:31:27 marco Exp $ */
+/* $OpenBSD: softraid.c,v 1.14 2007/03/31 12:57:08 marco Exp $ */
 /*
  * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
  *
@@ -607,7 +607,7 @@
 			continue;

 		id = bd->bd_diskid;
-		if (id > sc->sc_dis[vol]->sd_vol.sv_meta.svm_no_chunk)
+		if (id >= sc->sc_dis[vol]->sd_vol.sv_meta.svm_no_chunk)
 			break;

 		src = sc->sc_dis[vol]->sd_vol.sv_chunks[id];
@@ -629,17 +629,20 @@
 {
 	int			rv = EINVAL;

-#if SR_UNIT_TEST
-	int			i, vol, disk, state;
-
-	for (i = 0, vol = -1, disk = -1; i < SR_MAXSCSIBUS; i++) {
+#ifdef SR_UNIT_TEST
+	int			i, vol, state;
+	struct sr_discipline	*sd;
+
+	for (i = 0, vol = -1; i < SR_MAXSCSIBUS; i++) {
 		/* XXX this will not work when we stagger disciplines */
 		if (sc->sc_dis[i])
 			vol++;
 		if (vol != bs->bs_channel)
 			continue;
-		if (++disk != bs->bs_target)
-			continue;
+
+		sd = sc->sc_dis[vol];
+		if (bs->bs_target >= sd->sd_vol.sv_meta.svm_no_chunk)
+			goto done;

 		switch (bs->bs_status) {
 		case BIOC_SSONLINE:
@@ -662,8 +665,7 @@
 		printf("status change for %u:%u -> %u %u\n",
 		    bs->bs_channel, bs->bs_target, bs->bs_status, state);

-		sc->sc_dis[vol]->sd_set_chunk_state(sc->sc_dis[vol],
-		    bs->bs_target, bs->bs_status);
+		sd->sd_set_chunk_state(sd, bs->bs_target, bs->bs_status);

 		rv = 0;

@@ -1483,14 +1485,14 @@

 	if (states[BIOC_SDONLINE] == nd)
 		new_state = BIOC_SVONLINE;
+	else if (states[BIOC_SDONLINE] == 0)
+		new_state = BIOC_SVOFFLINE;
 	else if (states[BIOC_SDSCRUB] != 0)
 		new_state = BIOC_SVSCRUB;
 	else if (states[BIOC_SDREBUILD] != 0)
 		new_state = BIOC_SVREBUILD;
 	else if (states[BIOC_SDOFFLINE] != 0)
 		new_state = BIOC_SVDEGRADED;
-	else if (states[BIOC_SDONLINE] == 0)
-		new_state = BIOC_SVOFFLINE;
 	else {
 		printf("old_state = %d, ", old_state);
 		for (i = 0; i < nd; i++)


Update for ESP8266 2.2 core release

Update for ESP8266 2.2 core release

See:
https://github.com/esp8266/Arduino/commit/4c587e28bc188efc852039606cac64
1768323ee3

--- src/esp8266/libc_esp.c
+++ src/esp8266/libc_esp.c
@@ -16,7 +16,7 @@
     int ret;
     va_list arglist;
     va_start(arglist, format);
-    ret = ets_vprintf(format, arglist);
+    ret = ets_vprintf(ets_putc, format, arglist);
     va_end(arglist);
     return ret;
 }


Avoid inserting elements already present in index set

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@29836 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/include/deal.II/lac/constraint_matrix.templates.h
+++ deal.II/include/deal.II/lac/constraint_matrix.templates.h
@@ -1117,7 +1117,8 @@
           it != lines.end(); ++it)
         if (vec_owned_elements.is_element(it->line))
           for (unsigned int i=0; i<it->entries.size(); ++i)
-            needed_elements.add_index(it->entries[i].first);
+            if (!vec_owned_elements.is_element(it->entries[i].first))
+              needed_elements.add_index(it->entries[i].first);

       VectorType ghosted_vector;
       internal::import_vector_with_ghost_elements (vec,


Make sure ehci_open() invokes ehci_device_setintr() at splusb; found with splassert.

--- dev/usb/ehci.c
+++ dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ehci.c,v 1.101 2009/07/24 08:15:38 blambert Exp $ */
+/*	$OpenBSD: ehci.c,v 1.102 2009/09/05 10:25:55 miod Exp $ */
 /*	$NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $	*/

 /*
@@ -1592,7 +1592,10 @@
 		ival = pipe->interval;
 		if (ival == USBD_DEFAULT_INTERVAL)
 			ival = ed->bInterval;
-		return (ehci_device_setintr(sc, sqh, ival));
+		s = splusb();
+		err = ehci_device_setintr(sc, sqh, ival);
+		splx(s);
+		return (err);
 	case UE_ISOCHRONOUS:
 		pipe->methods = &ehci_device_isoc_methods;
 		if (ed->bInterval == 0 || ed->bInterval > 16) {


tests: storagepoolxml2argvtest: Use integrated command path stripping

Replace virTestClearCommandPath by virCommandToStringFull which allows
to strip the command prefix internally.

Signed-off-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>
Reviewed-by: Pavel Hrdina <d4772d05997b8abf035041e3b4f4996380ea7e7a@redhat.com>

--- tests/storagepoolxml2argvtest.c
+++ tests/storagepoolxml2argvtest.c
@@ -74,12 +74,11 @@
         goto cleanup;
     };

-    if (!(actualCmdline = virCommandToString(cmd, false))) {
+    if (!(actualCmdline = virCommandToStringFull(cmd, false, true))) {
         VIR_TEST_DEBUG("pool type '%s' failed to get commandline", defTypeStr);
         goto cleanup;
     }

-    virTestClearCommandPath(actualCmdline);
     if (virTestCompareToFile(actualCmdline, cmdline) < 0)
         goto cleanup;


Check if the device is being detached when returning from tsleep() and
in such case do not try to cleanup the device since this would make the
thread sleep again while keeping a reference to the softc.

Fix a panic found by sebastia@, ok pirofti@

--- dev/usb/ucom.c
+++ dev/usb/ucom.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ucom.c,v 1.62 2013/11/15 08:25:31 pirofti Exp $ */
+/*	$OpenBSD: ucom.c,v 1.63 2014/02/03 20:59:05 mpi Exp $ */
 /*	$NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $	*/

 /*
@@ -491,6 +491,12 @@
 				SET(tp->t_state, TS_WOPEN);
 				error = ttysleep(tp, &tp->t_rawq,
 				    TTIPRI | PCATCH, ttopen, 0);
+
+				if (usbd_is_dying(sc->sc_uparent)) {
+					splx(s);
+					return (EIO);
+				}
+
 				/*
 				 * If TS_WOPEN has been reset, that means the
 				 * cua device has been closed.  We don't want


sync comment with reality

sync comment with reality

--- dev/usb/umsm.c
+++ dev/usb/umsm.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: umsm.c,v 1.7 2007/05/03 09:45:03 jsg Exp $	*/
+/*	$OpenBSD: umsm.c,v 1.8 2007/05/13 12:17:30 fkr Exp $	*/

 /*
  * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -16,7 +16,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */

-/* Driver for Qualcomm MSM EVDO devices */
+/* Driver for Qualcomm MSM EVDO and UMTS communication devices */

 #include <sys/param.h>
 #include <sys/systm.h>


Fix issue with --self-cap-tune-config and --self-cap-tune-nvram being swapped

Signed-off-by: Nick Dyer <c8f0c1d5fcda9220e27043f45924e42042c4e015@itdev.co.uk>

--- src/mxt-app/self_cap.c
+++ src/mxt-app/self_cap.c
@@ -153,13 +153,13 @@

   switch (cmd)
   {
-    case CMD_SELF_CAP_TUNE_NVRAM:
+    case CMD_SELF_CAP_TUNE_CONFIG:
       mxt_info(mxt->ctx, "Store to Config");
       t109_command = T109_CMD_STORE_TO_CONFIG_RAM;
       break;

-    case CMD_SELF_CAP_TUNE_CONFIG:
     default:
+    case CMD_SELF_CAP_TUNE_NVRAM:
       mxt_info(mxt->ctx, "Store to NVRAM");
       t109_command = T109_CMD_STORE_TO_NVM;
       break;


fix JIT fuel update in non-signal-/-thread-decrement mode

svn: r2178

--- src/mzscheme/src/jit.c
+++ src/mzscheme/src/jit.c
@@ -895,6 +895,10 @@
   mz_push_local_p(JIT_R0, JIT_LOCAL2);
   (void)jit_calli(thread_block);
   mz_pop_local_p(JIT_R0, JIT_LOCAL2);
+#ifndef FUEL_AUTODECEREMENTS
+  (void)jit_movi_p(JIT_R1, &scheme_fuel_counter);
+  jit_ldr_i(JIT_R2, JIT_R1);
+#endif
   mz_patch_branch(ref5);
 #ifndef FUEL_AUTODECEREMENTS
   jit_subi_p(JIT_R2, JIT_R2, 0x1);


r5777/sofa-dev : FIX: #ifdef SOFA_DEV missing in SkinningMapping.

--- modules/sofa/component/mapping/SkinningMapping.h
+++ modules/sofa/component/mapping/SkinningMapping.h
@@ -151,11 +151,13 @@
     const sofa::helper::vector<unsigned int>& getRepartition() { return repartition.getValue(); }
     bool getComputeWeights() { return computeWeights; }

+#ifdef SOFA_DEV
     // Dual quat J matrix components
     void computeDqQ( Mat38& Q, const DualQuat& bn, const Coord& p);
     void computeDqN( Mat88& N, const DualQuat& bn, const DualQuat& b);
     void computeDqT( Mat88& T, const DualQuat& qi0);
     void computeDqL( Mat86& L, const DualQuat& qi, const Coord& ti);
+#endif
 };

 using core::Mapping;


Reintroduce unlit lighting after shader simplification.

--- model.c
+++ model.c
@@ -76,9 +76,10 @@
 	"	vec3 V = normalize(-var_Position);\n"
 	"	vec3 H = normalize(LightDirection + V);\n"
 	"	float diffuse = max(dot(N, LightDirection), 0.0);\n"
+	"	float specular = pow(max(dot(N, H), 0), Shininess);\n"
+	"	if (Unlit) { diffuse = 1; specular = 0; }\n"
 	"	vec3 Ka = albedo.rgb * LightAmbient;\n"
 	"	vec3 Kd = albedo.rgb * LightDiffuse * diffuse;\n"
-	"	float specular = pow(max(dot(N, H), 0), Shininess);\n"
 	"	vec3 Ks = LightSpecular * specular * gloss;\n"
 	"	if (opacity < 0.2) discard;\n"
 	"	gl_FragColor = vec4(Ka + Kd + Ks, opacity);\n"


Fix compilation issue redux2

Fix compilation issue redux2

--- parallel_hashmap/phmap.h
+++ parallel_hashmap/phmap.h
@@ -2470,7 +2470,7 @@

         Inner() {}

-        Inner(Params p) :
+        Inner(Params const &p) :
             set_(p.bucket_cnt, p.hashfn, p.eq, p.alloc)
         {}

@@ -2657,7 +2657,7 @@
     {}

     template <std::size_t... i>
-    parallel_hash_set(typename Inner::Params p,
+    parallel_hash_set(typename Inner::Params const &p,
                       phmap::index_sequence<i...>) : sets_{((void)i, p)...}
     {}


Comments.

Comments.

git-svn-id: 862faeed78cded1e835205427955152ddd748d7d@410 5dfbf39a-1452-0410-8a97-9e58fedde8e3

--- inc/com/diag/diminuto/diminuto_proxy.h
+++ inc/com/diag/diminuto/diminuto_proxy.h
@@ -9,6 +9,9 @@
  * Licensed under the terms in README.h

  * Chip Overclock <coverclock@diag.com>

  * http://www.diag.com/navigation/downloads/Diminuto.html

+ *
+ * This is an example of how powerful the preprocessor can be for code
+ * generation. But with great power comes great responsibility.
  */

 #define COM_DIAG_DIMINUTO_PROXY_POINTER_H(_PROXY_, _FUNCTION_, _RESULT_, _PARAMETERS_, _RETURN_, _ARGUMENTS_) \


Removed obsolete variable in TabulatedAtmosphere (Issue #740)

git-svn-id: 4d207786bcfdcf18f314dcbc6ac3fbe5f8a98c88@546 ac7aa084-b6da-11df-bf42-7fac39f0224f

--- Tudat/Astrodynamics/Aerodynamics/tabulatedAtmosphere.h
+++ Tudat/Astrodynamics/Aerodynamics/tabulatedAtmosphere.h
@@ -73,8 +73,7 @@
      * Default constructor.
      */
     TabulatedAtmosphere( )
-        : relativeDirectoryPath_( "/External/AtmosphereTables/" ),
-          atmosphereTableFile_( "" )
+        : atmosphereTableFile_( "" )
     { }

     //! Initialize atmosphere table reader.
@@ -90,13 +89,6 @@
      * \return The atmosphere table file.
      */
     std::string getAtmosphereTableFile( ) { return atmosphereTableFile_; }
-
-    //! Get relative directory path.
-    /*!
-     * Returns relative directory path.
-     * \return Relative directory path.
-     */
-    std::string getRelativeDirectoryPath( ) { return relativeDirectoryPath_; }

     //! Get local density.
     /*!
@@ -156,12 +148,6 @@

 private:

-    //! The relative directory path.
-    /*!
-     *  The relative path directory path.
-     */
-    std::string relativeDirectoryPath_;
-
     //! The file name of the atmosphere table.
     /*!
      *  The file name of the atmosphere table.


j'ai fait un changement dans ProcessingAdvanced mais ca ne marche pas, je reviens donc a la version precedente

--- include/algorithm/ProcessingAdvanced.h
+++ include/algorithm/ProcessingAdvanced.h
@@ -1249,8 +1249,8 @@
         int cluster=0;
         std::vector<int > v_list_i;
         std::vector<int > v_list_j;
-        for(unsigned int i =0;i<f.sizeI();i++){
-            for(unsigned int j =0;j<f.sizeJ();j++){
+        for(unsigned int j =0;j<f.sizeJ();j++){
+            for(unsigned int i =0;i<f.sizeI();i++){

                 if(f(i,j)>0&&map(i,j)==0){


ethernet:disable flow control when select l2_to_l3_copy_mode

--- components/ethernet/emac_main.c
+++ components/ethernet/emac_main.c
@@ -537,6 +537,10 @@
     } else {
         REG_CLR_BIT(EMAC_GMACCONFIG_REG, EMAC_GMACFESPEED);
     }
+#if CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE
+    emac_disable_flowctrl();
+    emac_config.emac_flow_ctrl_partner_support = false;
+#else
     if (emac_config.emac_flow_ctrl_enable == true) {
         if (emac_config.emac_phy_get_partner_pause_enable() == true && emac_config.emac_phy_get_duplex_mode() == ETH_MDOE_FULLDUPLEX) {
             emac_enable_flowctrl();
@@ -549,6 +553,7 @@
         emac_disable_flowctrl();
         emac_config.emac_flow_ctrl_partner_support = false;
     }
+#endif
     emac_mac_enable_txrx();
 }
 static void emac_process_link_updown(bool link_status)


Fix bogus flagging of effective addresses as invalid

Ah, what a difference a single ~ makes... such as flagging invalid EAs
as valid and vice versa.

--- assemble.c
+++ assemble.c
@@ -1931,7 +1931,7 @@
 		ix = 0;
 	    }

-	    if (b != -1 && b >= EXPR_REG_START && b < REG_ENUM_LIMIT) {
+	    if (b >= EXPR_REG_START && b < REG_ENUM_LIMIT) {
                 bt = regvals[b];
 		bx = reg_flags[b];
 	    } else {
@@ -1957,7 +1957,7 @@
 			return NULL; /* Invalid register */
 		    if (~sok & bx & SIZE_MASK)
 			return NULL; /* Invalid size */
-		    sok &= ~bx;
+		    sok &= bx;
 		}

                 /* While we're here, ensure the user didn't specify


Adjusted spcae alignment

Adjusted spcae alignment

--- targets/TARGET_STM/can_api.c
+++ targets/TARGET_STM/can_api.c
@@ -1136,7 +1136,7 @@
             success = 1;
         }
     } else if (format == CANAny) {
-	    success = 0;	// filter for CANAny is not supported by STM32, return a failure
+        success = 0;	// filter for CANAny is not supported by STM32, return a failure
     }

     return success;


Fix a double free.

Fix a double free.

--- assemble.c
+++ assemble.c
@@ -1605,7 +1605,6 @@
                             reg = get_register(value);
                             if (reg == NO_REG) {
                                 report(stack->top, "Illegal addressing mode\n");
-                                free_tree(value);
                                 reg = 0;
                             }


Fix RTR position bit in TX mailbox register

--- targets/TARGET_STM/can_api.c
+++ targets/TARGET_STM/can_api.c
@@ -277,9 +277,9 @@

     can->sTxMailBox[transmitmailbox].TIR &= CAN_TI0R_TXRQ;
     if (!(msg.format)) {
-      can->sTxMailBox[transmitmailbox].TIR |= ((msg.id << 21) | msg.type);
+      can->sTxMailBox[transmitmailbox].TIR |= ((msg.id << 21) | (msg.type << 1));
     } else {
-      can->sTxMailBox[transmitmailbox].TIR |= ((msg.id << 3) | CAN_ID_EXT | msg.type);
+      can->sTxMailBox[transmitmailbox].TIR |= ((msg.id << 3) | CAN_ID_EXT | (msg.type << 1));
     }

     /* Set up the DLC */


Update newSectionOnSectionLayout.c

Update newSectionOnSectionLayout.c

--- scripts/sectionScripts/newSectionOnSectionLayout.c
+++ scripts/sectionScripts/newSectionOnSectionLayout.c
@@ -9,7 +9,8 @@
 New Record/Request
 Set Field [ ruleSection::ksection; ruleSection::_Lgroup ]
 Set Field [ ruleSection::match; "section" ]
-Set Field [ ruleSection::aboutSection; "I will use this library section to make static memories of my thoughts about and experiences of _________________ to help me remember them and to also analyze, test, and so improve my critical thinking about _________________ ." ]
+Set Field [ ruleSection::aboutSection; "This library is for noting what we learn about _________________, collecting references to it, and testing or collecting samples of ___________________ to improve the quality of our thinking and doing or __________________ quality (if
+_________________ is a thing not a person)." ]
 Set Field [ ruleSection::kRecordCreatorNode; TEMP::kdefaultNodePrimary ]
 #Capture the name in case the node is deleted, and
 #and the section is not requiring the system to replace
@@ -20,11 +21,11 @@
 #If we need to recreate this section's creator node
 #we will need to know who created its creator node.
 Set Field [ ruleSection::kSectionCreatorNodesCreator; nodeLockSection::kRecordCreatorNode ]
-Set Field [ ruleSection::name; "section " & ruleSection::_Lgroup ]
-Set Field [ ruleSection::nameSpelling; "section " & groupTest::_Lgroup ]
+Set Field [ ruleSection::name; "Empty Library" ]
+Set Field [ ruleSection::nameSpelling; "Empty Library" ]
 Go to Field [ ruleSection::name ]
 #
 #Assign section as default section.
 Perform Script [ “setDefaultSection” ]
 #
-January 7, 平成26 12:13:17 Imagination Quality Management.fp7 - newSectionOnSectionLayout -1-
+January 28, 平成26 16:03:24 Empty Library copy.fp7 - newSectionOnSectionLayout -1-


Update func_counter.c (#43)

Update func_counter.c (#43)

* Update func_counter.c

--- targets/dummy/func_counter.c
+++ targets/dummy/func_counter.c
@@ -66,6 +66,9 @@

 void func_counter_destroy() {
   Word_t bytes_freed = 0;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wsign-compare"
   JLFA(bytes_freed, func_counter.array);
+#pragma GCC diagnostic pop
   (void)bytes_freed;
 }


Added enum to map distro logos to ascii characters for the ConkySymbols font family.

--- CustomCursor.h
+++ CustomCursor.h
@@ -2,6 +2,35 @@
 #define CUSTOMCURSOR_HPP

 namespace CustomCursor {
+
+	enum distro {
+		tux = 'a',
+		tux_inv = 'A',
+		ubuntu = 'o',
+		ubuntu_inv = 'O',
+		suse = 'p',
+		suse_inv = 'P',
+		redhat = 'q',
+		redhat_inv = 'Q',
+		fedora = 'r',
+		fedora_inv = 'R',
+		debian = 's',
+		debian_inv = 'S',
+		arch = 't',
+		arch_inv = 'T',
+		mint = 'u',
+		mint_inv = 'U',
+		mandriva = 'v',
+		mandriva_inv = 'V',
+		noidea = 'w',
+		noidea_inv = 'W',
+		gentoo = 'x',
+		gentoo_inv = 'X',
+		FreeBSD = 'y',
+		FreeBSD_inv = 'Y',
+		pardus = 'z',
+		pardus_inv = 'Z'
+	};

 	void latin_cross(QPainter&, const QRect&);
 	void chara(QPainter&, const QRect&, const char*, const QString&);
@@ -9,7 +38,7 @@
 	inline void draw_cursor(QPainter &painter, const QRect &cursorRect) {

 		//latin_cross(painter, cursorRect);
-		chara(painter, cursorRect, "ConkySymbols", "A");
+		chara(painter, cursorRect, "ConkySymbols", QString(gentoo));
 	}

 	inline void latin_cross(QPainter &painter, const QRect &cursorRect) {


*** empty log message ***

*** empty log message ***

--- Applications/VRP/src/Master/vrp_main.c
+++ Applications/VRP/src/Master/vrp_main.c
@@ -188,7 +188,7 @@
      }

    }
-
+   return (0);
 }

 #endif


ArmPkg/ArmLib: Marked functions as 'STATIC' if not exposed outside of the scope of the source file

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>

git-svn-id: 3158a46dfd52e07d1fda3e32e1ab2e353a00b20f@14446 6f19259b-4bc3-4df7-8a09-765794883524

--- ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
+++ ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
@@ -23,6 +23,7 @@
 #include "ArmV7Lib.h"
 #include "ArmLibPrivate.h"

+STATIC
 VOID
 PopulateLevel2PageTable (
   IN UINT32                         *SectionEntry,
@@ -120,6 +121,7 @@

 }

+STATIC
 VOID
 FillTranslationTable (
   IN  UINT32                        *TranslationTable,


mount: don't destruct an external mount-namespace (v2)

If a parent mount point is shared with exteranl mntns, a child will be
umounted from the external mntns too.

For example:
$ mount -t tmpfs xxx /root/tmp/
$ mount --make-shared tmp
$ mkdir tmp/xxx
$ mount -t tmpfs xxx /root/tmp/xxx
$ touch tmp/xxx/a

$ unshare -m umount tmp/xxx
$ ls -l tmp/xxx/a
ls: cannot access tmp/xxx/a: No such file or directory

This patch changes a parent mnt to private for umounting childrens.

v2: exit if a mount point can not be marked ad private

Signed-off-by: Andrey Vagin <74c05afa918858348d6db8037d82fa8124870113@openvz.org>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>

--- mount.c
+++ mount.c
@@ -590,6 +590,11 @@
 	if (!mi->parent)
 		return 0;

+	if (mount("none", mi->parent->mountpoint, "none", MS_REC|MS_PRIVATE, NULL)) {
+		pr_perror("Can't mark %s as private", mi->parent->mountpoint);
+		return -1;
+	}
+
 	if (umount(mi->mountpoint)) {
 		pr_perror("Can't umount at %s", mi->mountpoint);
 		return -1;


mount: use /dev/shm first as a tmp dir

mount: use /dev/shm first as a tmp dir

--- mount.c
+++ mount.c
@@ -250,6 +250,10 @@

 static bool mountGetDir(struct nsjconf_t *nsjconf, char *dir, const char *name)
 {
+	snprintf(dir, PATH_MAX, "/dev/shm/nsjail.%s", name);
+	if (mountMkdirAndTest(dir)) {
+		return true;
+	}
 	snprintf(dir, PATH_MAX, "/tmp/nsjail.%s", name);
 	if (mountMkdirAndTest(dir)) {
 		return true;


Fix cur restore in reload(). Also minor style chages.

--- myadm.c
+++ myadm.c
@@ -517,22 +517,19 @@

 void
 records(const Arg *arg) {
-	Item *choice;
 	MYSQL_RES *res;
+	View *v;
 	char *tbl;

 	if(!REFRESH("records")) {
-		choice = cloneitem(getitem(0));
-		selview = newaview("records", records);
-		selview->choice = choice;
-		selview->form = stfl_form(L"<items.stfl>");
+		v = newaview("records", records);
+		v->choice = cloneitem(getitem(0));
+		v->form = stfl_form(L"<items.stfl>");
+		selview = v;
 	}
 	if(!selview->choice->ncols)
 		die("records: no choice.\n");
-
-	tbl = calloc(selview->choice->lens[0] + 1, sizeof(char));
-	memcpy(tbl, selview->choice->cols[0], selview->choice->lens[0]);
-
+	tbl = selview->choice->cols[0];
 	if(!(res = mysql_exec("select * from `%s`", tbl)))
 		die("records: cannot select `%s`\n", tbl);
 	mysql_fillview(res, 1);
@@ -540,17 +537,19 @@
 	stfl_listview(selview->items, selview->fields, selview->form);
 	stfl_setf("title", "Records in `%s`", tbl);
 	stfl_setf("info", "---Core: %d record(s)", selview->nitems);
-	free(tbl);
 }

 void
 reload(const Arg *arg) {
-	const wchar_t *pos = stfl_get(selview->form, L"pos");
+	char tmp[8];
+
 	if(!selview->mode->func)
 		return;
 	selview->mode->func(NULL);
-	if(pos)
-		stfl_set(selview->form, L"pos", pos);
+	if(selview->cur) {
+		snprintf(tmp, sizeof tmp, "%d", selview->cur);
+		stfl_set(selview->form, L"pos", stfl_ipool_towc(ipool, tmp));
+	}
 }

 void
@@ -674,15 +673,15 @@

 void
 tables(const Arg *arg) {
-	Item *choice;
 	MYSQL_RES *res;
+	View *v;

 	if(!REFRESH("tables")) {
-		choice = cloneitem(getitem(0));
-		selview = newaview("tables", tables);
-		selview->choice = choice;
-		selview->form = stfl_form(L"<items.stfl>");
-		mysql_select_db(mysql, selview->choice->cols[0]);
+		v = newaview("tables", tables);
+		v->choice = cloneitem(getitem(0));
+		v->form = stfl_form(L"<items.stfl>");
+		mysql_select_db(mysql, v->choice->cols[0]);
+		selview = v;
 	}
 	if(!(res = mysql_exec("show tables")))
 		die("tables\n");


lockdep: Simplify debug atomic ops

lockdep: Simplify debug atomic ops

Simplify debug_atomic_inc/dec by using this_cpu_inc/dec() instead
of doing it through an indirect get_cpu_var() and a manual
incrementation.

Signed-off-by: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>

--- kernel/lockdep_internals.h
+++ kernel/lockdep_internals.h
@@ -140,19 +140,13 @@
 DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);

 #define debug_atomic_inc(ptr)			{		\
-	struct lockdep_stats *__cpu_lockdep_stats;		\
-								\
 	WARN_ON_ONCE(!irqs_disabled());				\
-	__cpu_lockdep_stats = &__get_cpu_var(lockdep_stats);	\
-	__cpu_lockdep_stats->ptr++;				\
+	this_cpu_inc(lockdep_stats.ptr);			\
 }

 #define debug_atomic_dec(ptr)			{		\
-	struct lockdep_stats *__cpu_lockdep_stats;		\
-								\
 	WARN_ON_ONCE(!irqs_disabled());				\
-	__cpu_lockdep_stats = &__get_cpu_var(lockdep_stats);	\
-	__cpu_lockdep_stats->ptr--;				\
+	this_cpu_inc(lockdep_stats.ptr);			\
 }

 #define debug_atomic_read(ptr)		({				\


ring-buffer: document reader page design

In a private email conversation I explained how the ring buffer
page worked by using silly ASCII art. Ingo suggested that I add
that to the comments of the code.

Here it is.

Requested-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Steven Rostedt <9d183ff83abfec5c556edaf86a280a53916a11d8@redhat.com>

--- kernel/trace/ring_buffer.c
+++ kernel/trace/ring_buffer.c
@@ -20,6 +20,74 @@
 #include <linux/fs.h>

 #include "trace.h"
+
+/*
+ * The ring buffer is made up of a list of pages. A separate list of pages is
+ * allocated for each CPU. A writer may only write to a buffer that is
+ * associated with the CPU it is currently executing on.  A reader may read
+ * from any per cpu buffer.
+ *
+ * The reader is special. For each per cpu buffer, the reader has its own
+ * reader page. When a reader has read the entire reader page, this reader
+ * page is swapped with another page in the ring buffer.
+ *
+ * Now, as long as the writer is off the reader page, the reader can do what
+ * ever it wants with that page. The writer will never write to that page
+ * again (as long as it is out of the ring buffer).
+ *
+ * Here's some silly ASCII art.
+ *
+ *   +------+
+ *   |reader|          RING BUFFER
+ *   |page  |
+ *   +------+        +---+   +---+   +---+
+ *                   |   |-->|   |-->|   |
+ *                   +---+   +---+   +---+
+ *                     ^               |
+ *                     |               |
+ *                     +---------------+
+ *
+ *
+ *   +------+
+ *   |reader|          RING BUFFER
+ *   |page  |------------------v
+ *   +------+        +---+   +---+   +---+
+ *                   |   |-->|   |-->|   |
+ *                   +---+   +---+   +---+
+ *                     ^               |
+ *                     |               |
+ *                     +---------------+
+ *
+ *
+ *   +------+
+ *   |reader|          RING BUFFER
+ *   |page  |------------------v
+ *   +------+        +---+   +---+   +---+
+ *      ^            |   |-->|   |-->|   |
+ *      |            +---+   +---+   +---+
+ *      |                              |
+ *      |                              |
+ *      +------------------------------+
+ *
+ *
+ *   +------+
+ *   |buffer|          RING BUFFER
+ *   |page  |------------------v
+ *   +------+        +---+   +---+   +---+
+ *      ^            |   |   |   |-->|   |
+ *      |   New      +---+   +---+   +---+
+ *      |  Reader------^               |
+ *      |   page                       |
+ *      +------------------------------+
+ *
+ *
+ * After we make this swap, the reader can hand this page off to the splice
+ * code and be done with it. It can even allocate a new page if it needs to
+ * and swap that into the ring buffer.
+ *
+ * We will be using cmpxchg soon to make all this lockless.
+ *
+ */

 /*
  * A fast way to enable or disable all ring buffers is to