If a bookmark doesn't have an explicit label, use the display name of the file

We query the file info for display name and icon synchronously.  If it becomes a problem,
we'll make it async, more in line with NautilusBookmark.

Signed-off-by: Federico Mena Quintero <4999915a961edfd7686112c2935288e1266eae14@gnome.org>

--- gtk/gtkplacessidebar.c
+++ gtk/gtkplacessidebar.c
@@ -910,6 +910,8 @@
 	bookmarks = _gtk_bookmarks_manager_list_bookmarks (sidebar->bookmarks_manager);

 	for (sl = bookmarks, index = 0; sl; sl = sl->next, index++) {
+		GFileInfo *info;
+
 		root = sl->data;

 #if 0
@@ -932,23 +934,36 @@
 		nautilus_file_unref (file);
 #endif

-		bookmark_name = _gtk_bookmarks_manager_get_bookmark_label (sidebar->bookmarks_manager, root);
-		icon = NULL; /* FIXME: icon = nautilus_bookmark_get_icon (bookmark); */
-		mount_uri = g_file_get_uri (root);
-		tooltip = g_file_get_parse_name (root);
-
-		add_place (sidebar, PLACES_BOOKMARK,
-			   SECTION_BOOKMARKS,
-			   bookmark_name, icon, mount_uri,
-			   NULL, NULL, NULL, index,
-			   tooltip);
-
-		if (icon)
-			g_object_unref (icon);
-
-		g_free (mount_uri);
-		g_free (tooltip);
-		g_free (bookmark_name);
+		/* FIXME: we are getting file info synchronously.  We may want to do it async at some point. */
+		info = g_file_query_info (root,
+					  "standard::display-name,standard::icon",
+					  G_FILE_QUERY_INFO_NONE,
+					  NULL,
+					  NULL); /* NULL-GError */
+
+		if (info) {
+			bookmark_name = _gtk_bookmarks_manager_get_bookmark_label (sidebar->bookmarks_manager, root);
+
+			if (bookmark_name == NULL)
+				bookmark_name = g_strdup (g_file_info_get_display_name (info));
+
+			icon = g_file_info_get_icon (info);
+
+			mount_uri = g_file_get_uri (root);
+			tooltip = g_file_get_parse_name (root);
+
+			add_place (sidebar, PLACES_BOOKMARK,
+				   SECTION_BOOKMARKS,
+				   bookmark_name, icon, mount_uri,
+				   NULL, NULL, NULL, index,
+				   tooltip);
+
+			g_free (mount_uri);
+			g_free (tooltip);
+			g_free (bookmark_name);
+
+			g_object_unref (info);
+		}
 	}

 	g_slist_foreach (bookmarks, (GFunc) g_object_unref, NULL);


themingengine: Redo color handling

themingengine: Redo color handling

Don't work on malloc()ed colors. Instead, use an array on the heap. This
makes it easier to copy the array.

--- gtk/gtkthemingengine.c
+++ gtk/gtkthemingengine.c
@@ -1382,7 +1382,7 @@
 render_frame_fill (cairo_t       *cr,
                    GtkRoundedBox *border_box,
                    GtkBorder     *border,
-                   GdkRGBA       *colors[4],
+                   GdkRGBA        colors[4],
                    guint          hidden_side)
 {
   static const guint current_side[4] = { SIDE_TOP, SIDE_RIGHT, SIDE_BOTTOM, SIDE_LEFT };
@@ -1393,11 +1393,11 @@
   _gtk_rounded_box_shrink (&padding_box, border->top, border->right, border->bottom, border->left);

   if (hidden_side == 0 &&
-      gdk_rgba_equal (colors[0], colors[1]) &&
-      gdk_rgba_equal (colors[0], colors[2]) &&
-      gdk_rgba_equal (colors[0], colors[3]))
-    {
-      gdk_cairo_set_source_rgba (cr, colors[0]);
+      gdk_rgba_equal (&colors[0], &colors[1]) &&
+      gdk_rgba_equal (&colors[0], &colors[2]) &&
+      gdk_rgba_equal (&colors[0], &colors[3]))
+    {
+      gdk_cairo_set_source_rgba (cr, &colors[0]);

       _gtk_rounded_box_path (border_box, cr);
       _gtk_rounded_box_path (&padding_box, cr);
@@ -1416,7 +1416,7 @@
                 continue;

               if (i == j ||
-                  (gdk_rgba_equal (colors[i], colors[j])))
+                  (gdk_rgba_equal (&colors[i], &colors[j])))
                 {
                   /* We were already painted when i == j */
                   if (i > j)
@@ -1436,7 +1436,7 @@
           if (i > j)
             continue;

-          gdk_cairo_set_source_rgba (cr, colors[i]);
+          gdk_cairo_set_source_rgba (cr, &colors[i]);

           cairo_fill (cr);
         }
@@ -1460,7 +1460,8 @@
   gboolean running;
   GtkBorder border;
   static const guint current_side[4] = { SIDE_TOP, SIDE_RIGHT, SIDE_BOTTOM, SIDE_LEFT };
-  GdkRGBA *colors[4];
+  GdkRGBA *alloc_colors[4];
+  GdkRGBA colors[4];
   guint i, j;

   state = gtk_theming_engine_get_state (engine);
@@ -1473,10 +1474,10 @@
                           "border-right-style", &border_style[1],
                           "border-bottom-style", &border_style[2],
                           "border-left-style", &border_style[3],
-                          "border-top-color", &colors[0],
-                          "border-right-color", &colors[1],
-                          "border-bottom-color", &colors[2],
-                          "border-left-color", &colors[3],
+                          "border-top-color", &alloc_colors[0],
+                          "border-right-color", &alloc_colors[1],
+                          "border-bottom-color", &alloc_colors[2],
+                          "border-left-color", &alloc_colors[3],
                           NULL);

   running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
@@ -1503,11 +1504,20 @@

       for (i = 0; i < 4; i++)
         {
-          colors[i]->red = CLAMP (colors[i]->red + ((other_colors[i]->red - colors[i]->red) * progress), 0, 1);
-          colors[i]->green = CLAMP (colors[i]->green + ((other_colors[i]->green - colors[i]->green) * progress), 0, 1);
-          colors[i]->blue = CLAMP (colors[i]->blue + ((other_colors[i]->blue - colors[i]->blue) * progress), 0, 1);
-          colors[i]->alpha = CLAMP (colors[i]->alpha + ((other_colors[i]->alpha - colors[i]->alpha) * progress), 0, 1);
+          colors[i].red = CLAMP (alloc_colors[i]->red + ((other_colors[i]->red - alloc_colors[i]->red) * progress), 0, 1);
+          colors[i].green = CLAMP (alloc_colors[i]->green + ((other_colors[i]->green - alloc_colors[i]->green) * progress), 0, 1);
+          colors[i].blue = CLAMP (alloc_colors[i]->blue + ((other_colors[i]->blue - alloc_colors[i]->blue) * progress), 0, 1);
+          colors[i].alpha = CLAMP (alloc_colors[i]->alpha + ((other_colors[i]->alpha - alloc_colors[i]->alpha) * progress), 0, 1);
           gdk_rgba_free (other_colors[i]);
+          gdk_rgba_free (alloc_colors[i]);
+        }
+    }
+  else
+    {
+      for (i = 0; i < 4; i++)
+        {
+          colors[i] = *alloc_colors[i];
+          gdk_rgba_free (alloc_colors[i]);
         }
     }

@@ -1528,11 +1538,11 @@
           break;
         case GTK_BORDER_STYLE_INSET:
           if (i == 1 || i == 2)
-            color_shade (colors[i], 1.8, colors[i]);
+            color_shade (&colors[i], 1.8, &colors[i]);
           break;
         case GTK_BORDER_STYLE_OUTSET:
           if (i == 0 || i == 3)
-            color_shade (colors[i], 1.8, colors[i]);
+            color_shade (&colors[i], 1.8, &colors[i]);
           break;
         case GTK_BORDER_STYLE_DOTTED:
         case GTK_BORDER_STYLE_DASHED:
@@ -1576,9 +1586,6 @@
   render_frame_fill (cr, &border_box, &border, colors, hidden_side);

 done:
-  for (i = 0; i < 4; i++)
-    gdk_rgba_free (colors[i]);
-
   cairo_restore (cr);
 }


server/tests: fix timer for test_empty_success

--- server/tests/test_empty_success.c
+++ server/tests/test_empty_success.c
@@ -4,9 +4,15 @@

 #include <spice.h>

+struct SpiceTimer {
+    int a,b;
+};
+
 SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
 {
-    return NULL;
+    static struct SpiceTimer t = {0,};
+
+    return &t;
 }

 void timer_start(SpiceTimer *timer, uint32_t ms)
@@ -57,5 +63,7 @@
     spice_server_set_port(server, 5911);
     spice_server_init(server, &core);

+    spice_server_destroy(server);
+
     return 0;
 }


Fix ESSAssert message formatting

Fix ESSAssert message formatting

--- Foundation/Foundation+Essentials.h
+++ Foundation/Foundation+Essentials.h
@@ -28,15 +28,15 @@
 #if !defined(NS_BLOCK_ASSERTIONS)

 #define ESSAssert(CONDITION, MESSAGE, ...)\
-if ( ! (CONDITION) && (( [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] file:[NSString stringWithUTF8String:__FILE__] lineNumber:__LINE__ description:(MESSAGE), ##__VA_ARGS__], YES)) )
+if ( ! (CONDITION) && (( [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] file:[NSString stringWithUTF8String:__FILE__] lineNumber:__LINE__ description:MESSAGE, ##__VA_ARGS__], YES)) )

 #else

 #define ESSAssert(CONDITION, MESSAGE, ...)\
-if ( ! (CONDITION) && (( NSLog(@"*** Assertion failure in %s, %s:%d, Condition not satisfied: %s, reason: '" (MESSAGE) "'", __PRETTY_FUNCTION__, __FILE__, __LINE__, #CONDITION, ##__VA_ARGS__), YES)) )
+if ( ! (CONDITION) && (( NSLog(@"*** Assertion failure in %s, %s:%d, Condition not satisfied: %s, reason: '" MESSAGE "'", __PRETTY_FUNCTION__, __FILE__, __LINE__, #CONDITION, ##__VA_ARGS__), YES)) )

 #endif

-#define ESSAssertReturn(CONDITION, MESSAGE, ...)        SGBAssert(CONDITION, MESSAGE, ##__VA_ARGS__) return;
-#define ESSAssertReturnNil(CONDITION, MESSAGE, ...)     SGBAssert(CONDITION, MESSAGE, ##__VA_ARGS__) return nil;
-#define ESSAssertException(CONDITION, MESSAGE, ...)     SGBAssert(CONDITION, MESSAGE, ##__VA_ARGS__) @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:[NSString stringWithFormat:@"*** Assertion failure in %s, %s:%d, Condition not satisfied: %s, reason: '" (MESSAGE) "'", __PRETTY_FUNCTION__, __FILE__, __LINE__, #CONDITION, ##__VA_ARGS__] userInfo:nil];
+#define ESSAssertReturn(CONDITION, MESSAGE, ...)        ESSAssert(CONDITION, MESSAGE, ##__VA_ARGS__) return
+#define ESSAssertReturnNil(CONDITION, MESSAGE, ...)     ESSAssert(CONDITION, MESSAGE, ##__VA_ARGS__) return nil
+#define ESSAssertException(CONDITION, MESSAGE, ...)     ESSAssert(CONDITION, MESSAGE, ##__VA_ARGS__) @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:[NSString stringWithFormat:@"*** Assertion failure in %s, %s:%d, Condition not satisfied: %s, reason: '" MESSAGE "'", __PRETTY_FUNCTION__, __FILE__, __LINE__, #CONDITION, ##__VA_ARGS__] userInfo:nil]


If the API server wasn't running then switching virtual consoles would crash. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@8378 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/api_control.c
+++ Programs/api_control.c
@@ -129,5 +129,6 @@

 int
 apiFlush (void) {
+  if (!apiStarted) return 1;
   return api_flush(&brl);
 }


Fill in more Windows locale names. (dm,st)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@5155 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/sys_windows.c
+++ Programs/sys_windows.c
@@ -315,17 +315,17 @@

 const char *
 win_getLocaleName (void) {
-  DWORD language;
+  DWORD langid;
   int result = GetLocaleInfo(GetThreadLocale(),
                              LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
-                             (char *)&language, sizeof(language)/sizeof(TCHAR));
+                             (char *)&langid, sizeof(langid)/sizeof(TCHAR));

   if (result > 0) {
-#define TERRITORY(l,t,s) case MAKELANGID(LANG_##l, SUBLANG_##l##_##t): return (s);
-    switch (language) {
+#define TERRITORY(language,territory,locale) case MAKELANGID(LANG_##language, SUBLANG_##language##_##territory): return (locale);
+    switch (langid) {
       TERRITORY(AFRIKAANS, SOUTH_AFRICA, "af_ZA");
       TERRITORY(ALBANIAN, ALBANIA, "sq_AL");
-      TERRITORY(ALSATIAN, FRANCE, "xx_FR");
+      TERRITORY(ALSATIAN, FRANCE, "gsw_FR");
       TERRITORY(AMHARIC, ETHIOPIA, "am_ET");
       TERRITORY(ARABIC, ALGERIA, "ar_DZ");
       TERRITORY(ARABIC, BAHRAIN, "ar_BH");
@@ -387,7 +387,7 @@
       TERRITORY(ENGLISH, ZIMBABWE, "en_ZW");
       TERRITORY(ESTONIAN, ESTONIA, "et_EE");
       TERRITORY(FAEROESE, FAROE_ISLANDS, "fo_FO");
-      TERRITORY(FILIPINO, PHILIPPINES, "xx_PH");
+      TERRITORY(FILIPINO, PHILIPPINES, "fil_PH");
       TERRITORY(FINNISH, FINLAND, "fi_FI");
       TERRITORY(FRENCH, BELGIAN, "fr_BE");
       TERRITORY(FRENCH, CANADIAN, "fr_CA");
@@ -395,7 +395,7 @@
       TERRITORY(FRENCH, MONACO, "fr_MC");
       TERRITORY(FRENCH, SWISS, "fr_CH");
       TERRITORY(FRISIAN, NETHERLANDS, "fy_NL");
-      TERRITORY(GALICIAN, GALICIAN, "gl_XX");
+      TERRITORY(GALICIAN, GALICIAN, "gl_ES");
       TERRITORY(GEORGIAN, GEORGIA, "ka_GE");
       TERRITORY(GERMAN, AUSTRIAN, "de_AT");
       TERRITORY(GERMAN, LIECHTENSTEIN, "de_LI");
@@ -420,12 +420,12 @@
       TERRITORY(KHMER, CAMBODIA, "km_KH");
       TERRITORY(KICHE, GUATEMALA, "xx_GT");
       TERRITORY(KINYARWANDA, RWANDA, "rw_RW");
-      TERRITORY(KONKANI, INDIA, "xx_IN");
+      TERRITORY(KONKANI, INDIA, "kok_IN");
       TERRITORY(KYRGYZ, KYRGYZSTAN, "ky_KG");
       TERRITORY(LAO, LAO_PDR, "lo_LA");
       TERRITORY(LATVIAN, LATVIA, "lv_LV");
       TERRITORY(LITHUANIAN, LITHUANIA, "lt_LT");
-      TERRITORY(LOWER_SORBIAN, GERMANY, "xx_DE");
+      TERRITORY(LOWER_SORBIAN, GERMANY, "dsb_DE");
       TERRITORY(LUXEMBOURGISH, LUXEMBOURG, "lb_LU");
       TERRITORY(MACEDONIAN, MACEDONIA, "mk_MK");
       TERRITORY(MALAY, BRUNEI_DARUSSALAM, "ms_BN");
@@ -433,15 +433,15 @@
       TERRITORY(MALAYALAM, INDIA, "ml_IN");
       TERRITORY(MALTESE, MALTA, "mt_MT");
       TERRITORY(MAORI, NEW_ZEALAND, "mi_NZ");
-      TERRITORY(MAPUDUNGUN, CHILE, "xx_CL");
+      TERRITORY(MAPUDUNGUN, CHILE, "arn_CL");
       TERRITORY(MARATHI, INDIA, "mr_IN");
-      TERRITORY(MOHAWK, MOHAWK, "xx_XX");
+      TERRITORY(MOHAWK, MOHAWK, "moh");
       TERRITORY(MONGOLIAN, CYRILLIC_MONGOLIA, "mn_MN");
-      TERRITORY(MONGOLIAN, PRC, "mn_XX");
+      TERRITORY(MONGOLIAN, PRC, "mn_CN");
       TERRITORY(NEPALI, INDIA, "ne_IN");
       TERRITORY(NEPALI, NEPAL, "ne_NP");
       TERRITORY(NORWEGIAN, BOKMAL, "no_XX");
-      TERRITORY(NORWEGIAN, NYNORSK, "no_XX");
+      TERRITORY(NORWEGIAN, NYNORSK, "nn_NO");
       TERRITORY(OCCITAN, FRANCE, "oc_FR");
       TERRITORY(ORIYA, INDIA, "or_IN");
       TERRITORY(PASHTO, AFGHANISTAN, "ps_AF");
@@ -457,13 +457,13 @@
       TERRITORY(ROMANIAN, MOLDOVA, "ro_MD");
       TERRITORY(ROMANIAN, ROMANIA, "ro_RO");
       TERRITORY(RUSSIAN, RUSSIA, "ru_RU");
-      TERRITORY(SAMI, LULE_NORWAY, "se_XX");
-      TERRITORY(SAMI, LULE_SWEDEN, "se_XX");
-      TERRITORY(SAMI, NORTHERN_FINLAND, "se_XX");
-      TERRITORY(SAMI, NORTHERN_NORWAY, "se_XX");
-      TERRITORY(SAMI, NORTHERN_SWEDEN, "se_XX");
-      TERRITORY(SAMI, SOUTHERN_NORWAY, "se_XX");
-      TERRITORY(SAMI, SOUTHERN_SWEDEN, "se_XX");
+      TERRITORY(SAMI, LULE_NORWAY, "smj_NO");
+      TERRITORY(SAMI, LULE_SWEDEN, "smj_SE");
+      TERRITORY(SAMI, NORTHERN_FINLAND, "sme_FI");
+      TERRITORY(SAMI, NORTHERN_NORWAY, "sme_NO");
+      TERRITORY(SAMI, NORTHERN_SWEDEN, "sme_SE");
+      TERRITORY(SAMI, SOUTHERN_NORWAY, "sma_NO");
+      TERRITORY(SAMI, SOUTHERN_SWEDEN, "sma_SE");
       TERRITORY(SANSKRIT, INDIA, "sa_IN");
       TERRITORY(SERBIAN, BOSNIA_HERZEGOVINA_CYRILLIC, "sr_BA");
       TERRITORY(SERBIAN, BOSNIA_HERZEGOVINA_LATIN, "sr_BA");
@@ -502,11 +502,11 @@
       TERRITORY(TELUGU, INDIA, "te_IN");
       TERRITORY(THAI, THAILAND, "th_TH");
       TERRITORY(TIBETAN, BHUTAN, "bo_BT");
-      TERRITORY(TIBETAN, PRC, "bo_XX");
+      TERRITORY(TIBETAN, PRC, "bo_CN");
       TERRITORY(TIGRIGNA, ERITREA, "ti_ER");
       TERRITORY(TSWANA, SOUTH_AFRICA, "tn_ZA");
       TERRITORY(TURKISH, TURKEY, "tr_TR");
-      TERRITORY(UIGHUR, PRC, "ug_XX");
+      TERRITORY(UIGHUR, PRC, "ug_CN");
       TERRITORY(UKRAINIAN, UKRAINE, "uk_UA");
     //TERRITORY(UPPER_SORBIAN, GERMANY, "xx_DE");
       TERRITORY(URDU, INDIA, "ur_IN");
@@ -517,18 +517,18 @@
       TERRITORY(WELSH, UNITED_KINGDOM, "cy_GB");
       TERRITORY(WOLOF, SENEGAL, "fy_SN");
       TERRITORY(XHOSA, SOUTH_AFRICA, "xh_ZA");
-      TERRITORY(YAKUT, RUSSIA, "xx_RU");
-      TERRITORY(YI, PRC, "yi_XX");
+      TERRITORY(YAKUT, RUSSIA, "sah_RU");
+      TERRITORY(YI, PRC, "ii_CN");
       TERRITORY(YORUBA, NIGERIA, "yo_NG");
       TERRITORY(ZULU, SOUTH_AFRICA, "zu_ZA");
     }
 #undef TERRITORY

-#define LANGUAGE(l,s) case LANG_##l: return (s);
-    switch (PRIMARYLANGID(language)) {
+#define LANGUAGE(language,locale) case LANG_##language: return (locale);
+    switch (PRIMARYLANGID(langid)) {
       LANGUAGE(AFRIKAANS, "af");
       LANGUAGE(ALBANIAN, "sq");
-      LANGUAGE(ALSATIAN, "xx");
+      LANGUAGE(ALSATIAN, "gsw");
       LANGUAGE(AMHARIC, "am");
       LANGUAGE(ARABIC, "ar");
       LANGUAGE(ARMENIAN, "hy");
@@ -548,13 +548,13 @@
     //LANGUAGE(CROATIAN, "hr");
       LANGUAGE(CZECH, "cs");
       LANGUAGE(DANISH, "da");
-      LANGUAGE(DARI, "xx");
+      LANGUAGE(DARI, "gbz");
       LANGUAGE(DIVEHI, "dv");
       LANGUAGE(DUTCH, "nl");
       LANGUAGE(ENGLISH, "en");
       LANGUAGE(ESTONIAN, "et");
       LANGUAGE(FAEROESE, "fo");
-      LANGUAGE(FILIPINO, "xx");
+      LANGUAGE(FILIPINO, "fil");
       LANGUAGE(FINNISH, "fi");
       LANGUAGE(FRENCH, "fr");
       LANGUAGE(FRISIAN, "fy");
@@ -581,24 +581,24 @@
       LANGUAGE(KHMER, "km");
       LANGUAGE(KICHE, "xx");
       LANGUAGE(KINYARWANDA, "rw");
-      LANGUAGE(KONKANI, "xx");
+      LANGUAGE(KONKANI, "kok");
       LANGUAGE(KOREAN, "ko");
       LANGUAGE(KYRGYZ, "ky");
       LANGUAGE(LAO, "lo");
       LANGUAGE(LATVIAN, "lv");
       LANGUAGE(LITHUANIAN, "lt");
-      LANGUAGE(LOWER_SORBIAN, "xx");
+      LANGUAGE(LOWER_SORBIAN, "dsb");
       LANGUAGE(LUXEMBOURGISH, "lb");
       LANGUAGE(MACEDONIAN, "mk");
       LANGUAGE(MALAGASY, "mg");
       LANGUAGE(MALAY, "ms");
       LANGUAGE(MALAYALAM, "ml");
       LANGUAGE(MALTESE, "mt");
-      LANGUAGE(MANIPURI, "xx");
+      LANGUAGE(MANIPURI, "mni");
       LANGUAGE(MAORI, "mi");
-      LANGUAGE(MAPUDUNGUN, "xx");
+      LANGUAGE(MAPUDUNGUN, "arn");
       LANGUAGE(MARATHI, "mr");
-      LANGUAGE(MOHAWK, "xx");
+      LANGUAGE(MOHAWK, "moh");
       LANGUAGE(MONGOLIAN, "mn");
       LANGUAGE(NEPALI, "ne");
       LANGUAGE(NORWEGIAN, "no");
@@ -624,7 +624,7 @@
       LANGUAGE(SPANISH, "es");
       LANGUAGE(SWAHILI, "sw");
       LANGUAGE(SWEDISH, "sv");
-      LANGUAGE(SYRIAC, "xx");
+      LANGUAGE(SYRIAC, "syr");
       LANGUAGE(TAMAZIGHT, "xx");
       LANGUAGE(TAMIL, "ta");
       LANGUAGE(TATAR, "tt");
@@ -643,8 +643,8 @@
       LANGUAGE(WELSH, "cy");
       LANGUAGE(WOLOF, "fy");
       LANGUAGE(XHOSA, "xh");
-      LANGUAGE(YAKUT, "xx");
-      LANGUAGE(YI, "yi");
+      LANGUAGE(YAKUT, "sah");
+      LANGUAGE(YI, "ii");
       LANGUAGE(YORUBA, "yo");
       LANGUAGE(ZULU, "zu");
     }


SDEI: updata the affinity of shared event

when updata routing of an SDEI event, if the registration flags
is SDEI_REGF_RM_PE, need to updata the affinity of shared event.

Signed-off-by: Tony Xie <785c813dc55d8566cc7479896e061ba8b0d7bbab@rock-chips.com>
Change-Id: Ie5d7cc4199253f6af1c28b407f712caac3092d06

--- services/std_svc/sdei/sdei_main.c
+++ services/std_svc/sdei/sdei_main.c
@@ -314,6 +314,9 @@

 	/* Update event registration flag */
 	se->reg_flags = (unsigned int) flags;
+	if (flags == SDEI_REGF_RM_PE) {
+		se->affinity = (mpidr & MPIDR_AFFINITY_MASK);
+	}

 	/*
 	 * ROUTING_SET is permissible only when event composite state is


SK_API isn't needed on ConvolutionFilter1D::FilterInstance.
- Minor cleanup from http://codereview.chromium.org/6674050/

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6713015

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@79142 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

--- skia/ext/convolver.h
+++ skia/ext/convolver.h
@@ -119,7 +119,7 @@
   }

  private:
-  struct SK_API FilterInstance {
+  struct FilterInstance {
     // Offset within filter_values for this instance of the filter.
     int data_location;


tweak fcmh display

tweak fcmh display

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@19566 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- share/ctlcli_common.c
+++ share/ctlcli_common.c
@@ -165,9 +165,9 @@

 	w = psc_ctl_get_display_maxwidth() - PSC_CTL_DISPLAY_WIDTH;
 	printf("%-16s %11s %6s %5s %5s "
-	    "%7s %4s %9s %4s %4s",
+	    "%7s %3s %7s %4s %4s",
 	    "file-ID_(in_hex)", "flags", "mode", "uid", "gid",
-	    "size", "#ref", "fgen", "pgen", "ugen");
+	    "size", "ref", "fgen", "pgen", "ugen");
 	if (w > 6)
 		printf(" %6s", BLKSIZE_LABEL);
 	printf("\n");
@@ -182,21 +182,23 @@

 	w = psc_ctl_get_display_maxwidth() - PSC_CTL_DISPLAY_WIDTH;
 	psc_fmt_human(buf, scf->scf_size);
-	printf("%016"SLPRIxFID" %c%c%c%c%c%c%c%c%c%c%c "
-	    "%6o %5u %5u "
-	    "%7s %4d %9s %4u %4u",
+	printf("%016"SLPRIxFID" %c%c%c%c%c%c%c%c%c%c%c%c "
+	    "%6o %5u %5u %7s "
+	    "%3d %7s "
+	    "%4u %4u",
 	    scf->scf_fg.fg_fid,
-	    scf->scf_flags & FCMH_CAC_FREE	? 'F' : '-',
 	    scf->scf_flags & FCMH_CAC_IDLE	? 'i' : '-',
 	    scf->scf_flags & FCMH_CAC_BUSY	? 'B' : '-',
 	    scf->scf_flags & FCMH_CAC_INITING	? 'I' : '-',
 	    scf->scf_flags & FCMH_CAC_WAITING	? 'W' : '-',
 	    scf->scf_flags & FCMH_CAC_TOFREE	? 'T' : '-',
 	    scf->scf_flags & FCMH_CAC_REAPED	? 'R' : '-',
+	    scf->scf_flags & FCMH_CAC_RLSBMAP	? 'L' : '-',
 	    scf->scf_flags & FCMH_HAVE_ATTRS	? 'A' : '-',
 	    scf->scf_flags & FCMH_GETTING_ATTRS	? 'G' : '-',
 	    scf->scf_flags & FCMH_CTOR_FAILED	? 'f' : '-',
 	    scf->scf_flags & FCMH_NO_BACKFILE	? 'N' : '-',
+	    scf->scf_flags & FCMH_BUSY		? 'S' : '-',
 	    scf->scf_st_mode, scf->scf_uid, scf->scf_gid, buf,
 	    scf->scf_refcnt, sl_sprinta_fgen(scf->scf_fg.fg_gen),
 	    scf->scf_ptruncgen, scf->scf_utimgen);


Fixed for float point operation.

Fixed for float point operation.

--- source/image_processing/computed_field_gabor_filter.c
+++ source/image_processing/computed_field_gabor_filter.c
@@ -390,7 +390,7 @@
 		return_code = 1;
 		theta = M_PI * ((FE_value)direction[0]/(FE_value)direction[1]);

-		radius = (int) ceil(2.5 * sigma);
+		radius = (int) (ceil(2.5 * sigma));
 		filter_size = 1 + 2 * radius;

 		kernel_size = 1;
@@ -437,11 +437,11 @@
 					kernel_step *= filter_size;
 					image_step *= image->sizes[m];
 				}
-				s = cord[0] * cos(theta) + cord[1] * sin(theta);
-				t = -cord[0] * sin(theta) + cord[1] * cos(theta);
+				s = ((FE_value)cord[0]) * cos(theta) + ((FE_value)cord[1]) * sin(theta);
+				t = -((FE_value)cord[0]) * sin(theta) + ((FE_value)cord[1]) * cos(theta);
 				g = 0.64 * pow(2.7, -0.5 * (s*s + 16.0 * t*t)/(sigma*sigma))/ (sigma*sigma);
-				re_kernel[j] = g * cos(6.28 *(cord[0] * frequencies[0] + cord[1] * frequencies[1]));
-				im_kernel[j] = g * sin(6.28 *(cord[0] * frequencies[0] + cord[1] * frequencies[1]));
+				re_kernel[j] = g * cos(6.28 *(((FE_value)cord[0]) * frequencies[0] + ((FE_value)cord[1]) * frequencies[1]));
+				im_kernel[j] = g * sin(6.28 *(((FE_value)cord[0]) * frequencies[0] + ((FE_value)cord[1]) * frequencies[1]));
 			}

 			data_index = (FE_value *)image->data;
@@ -474,6 +474,7 @@
 					max[k] = my_Max(max[k], result_index[k]);
 				}
 			}
+
 			for (i = 0; i < storage_size / image->depth; i++)
 			{
 				for (k = 0; k < image->depth; k++)


Wrong class name changed

Wrong class name changed

--- FTL/include/Property.h
+++ FTL/include/Property.h
@@ -513,7 +513,7 @@
 			return PropertyGetterBase<Type>::operator->();
 		}

-		InterfaceType operator+(const PropertyBase& rhs) const
+		InterfaceType operator+(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator+(rhs);
 		}
@@ -523,7 +523,7 @@
 			return PropertyGetterBase<Type>::operator+(rhs);
 		}

-		InterfaceType operator-(const PropertyBase& rhs) const
+		InterfaceType operator-(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator-(rhs);
 		}
@@ -533,7 +533,7 @@
 			return PropertyGetterBase<Type>::operator-(rhs);
 		}

-		InterfaceType operator*(const PropertyBase& rhs) const
+		InterfaceType operator*(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator*(rhs);
 		}
@@ -543,7 +543,7 @@
 			return PropertyGetterBase<Type>::operator*(rhs);
 		}

-		InterfaceType operator/(const PropertyBase& rhs) const
+		InterfaceType operator/(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator/(rhs);
 		}
@@ -553,7 +553,7 @@
 			return PropertyGetterBase<Type>::operator/(rhs);
 		}

-		InterfaceType operator+=(const PropertyBase& rhs)
+		InterfaceType operator+=(const Property& rhs)
 		{
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator+=(rhs);
 		}
@@ -563,7 +563,7 @@
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator+=(rhs);
 		}

-		InterfaceType operator-=(const PropertyBase& rhs)
+		InterfaceType operator-=(const Property& rhs)
 		{
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator-=(rhs);
 		}
@@ -573,7 +573,7 @@
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator-=(rhs);
 		}

-		InterfaceType operator*=(const PropertyBase& rhs)
+		InterfaceType operator*=(const Property& rhs)
 		{
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator*=(rhs);
 		}
@@ -583,7 +583,7 @@
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator*=(rhs);
 		}

-		InterfaceType operator/=(const PropertyBase& rhs)
+		InterfaceType operator/=(const Property& rhs)
 		{
 			return PropertyBase<Type, PropertyAccessorSaveType::Both>::operator/=(rhs);
 		}
@@ -635,7 +635,7 @@
 			return PropertyGetterBase<Type>::operator->();
 		}

-		InterfaceType operator+(const PropertyBase& rhs) const
+		InterfaceType operator+(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator+(rhs);
 		}
@@ -645,7 +645,7 @@
 			return PropertyGetterBase<Type>::operator+(rhs);
 		}

-		InterfaceType operator-(const PropertyBase& rhs) const
+		InterfaceType operator-(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator-(rhs);
 		}
@@ -655,7 +655,7 @@
 			return PropertyGetterBase<Type>::operator-(rhs);
 		}

-		InterfaceType operator*(const PropertyBase& rhs) const
+		InterfaceType operator*(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator*(rhs);
 		}
@@ -665,7 +665,7 @@
 			return PropertyGetterBase<Type>::operator*(rhs);
 		}

-		InterfaceType operator/(const PropertyBase& rhs) const
+		InterfaceType operator/(const Property& rhs) const
 		{
 			return PropertyGetterBase<Type>::operator/(rhs);
 		}


Fixed using varargs in combination with C++ reference types, which apparently results in undefined behavior.

--- ext/common/Utils/MessageIO.h
+++ ext/common/Utils/MessageIO.h
@@ -1,6 +1,6 @@
 /*
  *  Phusion Passenger - https://www.phusionpassenger.com/
- *  Copyright (c) 2011 Phusion
+ *  Copyright (c) 2011-2014 Phusion
  *
  *  "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
  *
@@ -492,7 +492,7 @@
 }

 inline void
-writeArrayMessage(int fd, const StaticString &name, va_list &ap, unsigned long long *timeout = NULL) {
+writeArrayMessageVA(int fd, const StaticString &name, va_list &ap, unsigned long long *timeout = NULL) {
 	StaticString args[10];
 	unsigned int nargs = 1;
 	bool done = false;
@@ -547,16 +547,11 @@
  * arguments as message elements. The list must be terminated with a NULL.
  */
 inline void
-writeArrayMessage(int fd, const StaticString &name, ...) {
+writeArrayMessage(int fd, const char *name, ...) {
 	va_list ap;
 	va_start(ap, name);
 	_VaGuard guard(ap);
-	writeArrayMessage(fd, name, ap);
-}
-
-inline void
-writeArrayMessage(int fd, const char *name) {
-	abort();
+	writeArrayMessageVA(fd, name, ap);
 }

 /** Version of writeArrayMessage() that accepts a variadic list of 'const char *'
@@ -564,11 +559,11 @@
  * with a NULL.
  */
 inline void
-writeArrayMessage(int fd, unsigned long long *timeout, const StaticString &name, ...) {
+writeArrayMessage(int fd, unsigned long long *timeout, const char *name, ...) {
 	va_list ap;
 	va_start(ap, name);
 	_VaGuard guard(ap);
-	writeArrayMessage(fd, name, ap, timeout);
+	writeArrayMessageVA(fd, name, ap, timeout);
 }

 /**


(_hg_operator_real_readline): implemented.

--- hieroglyph/hgoperator.c
+++ hieroglyph/hgoperator.c
@@ -5981,7 +5981,106 @@
 VALIDATE_STACK_SIZE (0, 0, 0);
 DEFUNC_OPER_END

-DEFUNC_UNIMPLEMENTED_OPER (readline);
+/* <file> <string> readline <substring> <bool> */
+DEFUNC_OPER (readline)
+G_STMT_START {
+	hg_quark_t arg0, arg1, q, qs;
+	hg_file_t *f = NULL;
+	hg_string_t *s = NULL;
+	gchar c[2];
+	gboolean eol = FALSE;
+
+	CHECK_STACK (ostack, 2);
+
+	arg0 = hg_stack_index(ostack, 1, error);
+	arg1 = hg_stack_index(ostack, 0, error);
+
+	if (!HG_IS_QFILE (arg0)) {
+		hg_vm_set_error(vm, qself, HG_VM_e_typecheck);
+		return FALSE;
+	}
+	if (!HG_IS_QSTRING (arg1)) {
+		hg_vm_set_error(vm, qself, HG_VM_e_typecheck);
+		return FALSE;
+	}
+	if (!hg_vm_quark_is_readable(vm, &arg0) ||
+	    !hg_vm_quark_is_writable(vm, &arg1)) {
+		hg_vm_set_error(vm, qself, HG_VM_e_invalidaccess);
+		return FALSE;
+	}
+
+	f = HG_VM_LOCK (vm, arg0, error);
+	if (f == NULL) {
+		hg_vm_set_error(vm, qself, HG_VM_e_VMerror);
+		return FALSE;
+	}
+	s = HG_VM_LOCK (vm, arg1, error);
+	if (s == NULL) {
+		hg_vm_set_error(vm, qself, HG_VM_e_VMerror);
+		goto finalize;
+	}
+
+	hg_string_clear(s);
+
+	while (!hg_file_is_eof(f)) {
+		if (hg_string_length(s) >= hg_string_maxlength(s)) {
+			hg_vm_set_error(vm, qself, HG_VM_e_rangecheck);
+			goto finalize;
+		}
+	  retry:
+		hg_file_read(f, c, sizeof (gchar), 1, error);
+		if (c[0] == '\r') {
+			if (eol)
+				goto rollback;
+			eol = TRUE;
+			goto retry;
+		} else if (c[0] == '\n') {
+			break;
+		}
+		if (eol) {
+		  rollback:
+			hg_file_seek(f, -1, HG_FILE_POS_CURRENT, error);
+			break;
+		}
+		hg_string_append_c(s, c[0], error);
+	}
+	if (hg_file_is_eof(f)) {
+		q = HG_QBOOL (FALSE);
+	} else {
+		q = HG_QBOOL (TRUE);
+	}
+	if (hg_string_maxlength(s) > hg_string_length(s)) {
+		qs = hg_string_make_substring(s, 0, hg_string_length(s) - 1, NULL, error);
+		if (qs == Qnil) {
+			hg_vm_set_error(vm, qself, HG_VM_e_VMerror);
+			goto finalize;
+		}
+		hg_vm_quark_set_attributes(vm, &qs,
+					   hg_vm_quark_is_readable(vm, &arg1),
+					   hg_vm_quark_is_writable(vm, &arg1),
+					   hg_vm_quark_is_executable(vm, &arg1),
+					   hg_vm_quark_is_editable(vm, &arg1));
+	} else {
+		qs = arg1;
+	}
+	if (qs == arg1)
+		hg_stack_pop(ostack, error);
+	else
+		hg_stack_drop(ostack, error);
+	hg_stack_drop(ostack, error);
+
+	STACK_PUSH (ostack, qs);
+	STACK_PUSH (ostack, q);
+
+	retval = TRUE;
+  finalize:
+	if (f)
+		HG_VM_UNLOCK (vm, arg0);
+	if (s)
+		HG_VM_UNLOCK (vm, arg1);
+} G_STMT_END;
+VALIDATE_STACK_SIZE (0, 0, 0);
+DEFUNC_OPER_END

 /* -array- readonly -array-
  * -packedarray- readonly -packedarray-


don't forget to unref objects in unit tests

--- tests/check/ges/backgroundsource.c
+++ tests/check/ges/backgroundsource.c
@@ -103,6 +103,7 @@
   gnl_object_check (trackobject->gnlobject, 420, 510, 120, 510, 0, TRUE);

   ges_timeline_object_release_track_object (object, trackobject);
+  g_object_unref (object);
 }

 GST_END_TEST;
@@ -147,7 +148,13 @@
   ptrn = ((GESTrackVideoBackgroundSource *) trobj)->pattern;
   assert_equals_int (ptrn, GES_TRACK_VIDEO_BG_SRC_WHITE);

+  GST_DEBUG ("removing the source");
+
   ges_timeline_layer_remove_object (layer, (GESTimelineObject *) source);
+
+  GST_DEBUG ("removing the layer");
+
+  g_object_unref (trobj);
   g_object_unref (timeline);
 }


Started working on matrix subtract in GPU_operations

--- cpp/include/gpu_operations.h
+++ cpp/include/gpu_operations.h
@@ -129,7 +129,19 @@
   static Matrix<T> Add(const Matrix<T> &a, const T &scalar);
   static Matrix<T> Add(const Matrix<T> &a, const Matrix<T> &b);
   static Matrix<T> Subtract(const Matrix<T> &a, const T &scalar);
-  static Matrix<T> Subtract(const Matrix<T> &a, const Matrix<T> &b);
+  static Matrix<T> Subtract(const Matrix<T> &a, const Matrix<T> &b) {
+      // If the matricies aren't identical sizes then we cannot subtract them.
+      if (a.rows() != b.rows() || a.cols() != b.cols()) {
+        std::cerr << "Matricies are not the same size" << std::endl;
+
+      // If the matricies are empty this function should not run.
+    } else if (a.rows() == 0) {
+        std::cerr << "Matricies are empty" << std::endl;
+
+      // Otherwise, everything should run fine.
+    } else {
+
+  }
   static Matrix<T> Inverse(const Matrix<T> &a) {
     // Sanity Check
     if (a.rows() != a.cols()) {


I2C Comms finally work

I2C Comms finally work

Buffer size was set too small/ sizeof was giving the wrong value

Lesson Learned: Always pass the buffer size!

--- socket_stream/main.c
+++ socket_stream/main.c
@@ -51,7 +51,7 @@

 int processMsg(char sendBuff[], const char* msg);

-int pollArduino(char buffer[], const char msg[]);
+int pollArduino(char buffer[], const char msg[], const int buffSize);

 int openI2C();

@@ -176,15 +176,16 @@
         status = -1;
     } else if (strncmp(msg, GET_RANGE_READING, 3) == 0) {
         // Request Sonar Readings from Arduino
-        char sonarData[MAX_MSG_SIZE];
-        char cmd[32];
+        int n = 16;
+        char sonarData[n];
+        char cmd[n];
         int i;
         for(i=0; i < NUM_SONAR; i++){
             // Construct Command
             sprintf(cmd, "s%d", i);

             // Poll Arduino
-            int dataSize = pollArduino(sonarData, cmd);
+            int dataSize = pollArduino(sonarData, cmd, n);

             // Append to sendBuff
             strcat(sendBuff, sonarData);
@@ -217,27 +218,30 @@
     return status;
 }

-int pollArduino(char buffer[], const char msg[]){
+int pollArduino(char buffer[], const char msg[], const int buffSize){
     // Send msg to arduino
     int n = write(i2c_bus, msg, strlen(msg));
     if (n == -1){
         return -1;
     }
-
+
     // Receive Message from arduino
-    if (read(i2c_bus, buffer, sizeof(buffer)) <0) {
-        /* ERROR HANDLING: i2c transaction failed */
-        printf("Failed to read from the i2c bus.\n");
-        printf(buffer);
-        printf("\n\n");
-        return -1;
-    } else {
-        // Clear chars after newline
-        //buffer[strcspn(buffer, "\n")] = 0;
-
-        // Type case as unsigned long
-        printf("Msg: %s\n", buffer);
-    }
+    int i = 0; char new;
+    while(i < buffSize){
+      // Read in next char
+      if((read(i2c_bus, &new, 1)) == 1){
+        // Check for end of message
+        if(new == '\n') break;
+
+        // Add new to buffer
+        buffer[i] = new;
+        i++;
+
+      }
+    }
+
+    // Print Buffer
+    printf("%s \n", buffer);

     // Return size of buffer
     return strlen(buffer);


ARROW-13459: [C++][Docs]Missing param docs for RecordBatch::SetColumn

Signed-off-by: Junwang Zhao <09dd02a3136250300157b7d8a9042f64386668f6@gmail.com>

Closes #11056 from zhjwpku/docs/missing_param_for_setcolumn

Authored-by: Junwang Zhao <09dd02a3136250300157b7d8a9042f64386668f6@gmail.com>
Signed-off-by: David Li <dc24f9cfc84fb1675ce65c8444a2c3e2f0e5f297@gmail.com>

--- cpp/src/arrow/record_batch.h
+++ cpp/src/arrow/record_batch.h
@@ -130,6 +130,10 @@
       int i, std::string field_name, const std::shared_ptr<Array>& column) const;

   /// \brief Replace a column in the record batch, producing a new RecordBatch
+  ///
+  /// \param[in] i field index, does boundscheck
+  /// \param[in] field field to be replaced
+  /// \param[in] column column to be replaced
   virtual Result<std::shared_ptr<RecordBatch>> SetColumn(
       int i, const std::shared_ptr<Field>& field,
       const std::shared_ptr<Array>& column) const = 0;


random|histogram-example: improving display results (PDF, statistics)

--- examples/random_histogram_example.c
+++ examples/random_histogram_example.c
@@ -39,8 +39,9 @@

 int main(int argc, char*argv[])
 {
+    srand(time(NULL));
     unsigned long int num_trials = 100000; // number of trials
-    unsigned int num_bins = 20;
+    unsigned int num_bins = 30;
     enum {
         UNIFORM=0,
         NORMAL,
@@ -49,7 +50,7 @@
         GAMMA,
         NAKAGAMIM,
         RICEK
-    } distribution=0;
+    } distribution=NORMAL;

     // distribution parameters
     float eta = 0.0f;       // NORMAL: mean
@@ -66,7 +67,7 @@
     float omegarice = 1.0f; // RICE-K: spread factor

     int dopt;
-    while ((dopt = getopt(argc,argv,"uhn:d:e:s:l:a:b:g:A:B:m:o:K:O:")) != EOF) {
+    while ((dopt = getopt(argc,argv,"uhN:n:d:e:s:l:a:b:g:A:B:m:o:K:O:")) != EOF) {
         switch (dopt) {
         case 'u':
         case 'h':
@@ -103,6 +104,15 @@
         }
     }

+    // validate input
+    if (num_bins == 0) {
+        fprintf(stderr,"error: %s, number of bins must be greater than zero\n", argv[0]);
+        exit(1);
+    } else if (num_trials == 0) {
+        fprintf(stderr,"error: %s, number of trials must be greater than zero\n", argv[0]);
+        exit(1);
+    }
+
     float xmin = 0.0f;
     float xmax = 1.0f;

@@ -127,10 +137,10 @@
         xmax = 6.5 * betag + 2.0*alphag;
     } else if (distribution == NAKAGAMIM) {
         xmin = 0.0f;
-        xmax = 2.0f * sqrtf(omeganak);
+        xmax = 1.5f*( powf(omeganak, 0.8f) + 1.0f/m );
     } else if (distribution == RICEK) {
         xmin = 0.0f;
-        xmax = 2.3f * sqrtf(omegarice);
+        xmax = 3.0f*logf(omegarice+1.0f) + 1.5f/(K+1.0f);
     } else {
         fprintf(stderr, "error: %s, unknown/unsupported distribution\n", argv[0]);
         exit(1);
@@ -147,15 +157,17 @@

     // generate random variables
     float x = 0.0f;
+    float m1 = 0.0f;    // first moment
+    float m2 = 0.0f;    // second moment
     for (i=0; i<num_trials; i++) {
         switch (distribution) {
-        case UNIFORM:     x = randf(); break;
-        case NORMAL:      x = sigma*randnf() + eta; break;
-        case EXPONENTIAL: x = randexpf(lambda); break;
-        case WEIBULL:     x = randweibf(alphaw,betaw,gammaw); break;
-        case GAMMA:       x = randgammaf(alphag,betag); break;
-        case NAKAGAMIM:   x = randnakmf(m,omeganak); break;
-        case RICEK:       x = randricekf(K,omegarice); break;
+        case UNIFORM:     x = randf();                          break;
+        case NORMAL:      x = sigma*randnf() + eta;             break;
+        case EXPONENTIAL: x = randexpf(lambda);                 break;
+        case WEIBULL:     x = randweibf(alphaw,betaw,gammaw);   break;
+        case GAMMA:       x = randgammaf(alphag,betag);         break;
+        case NAKAGAMIM:   x = randnakmf(m,omeganak);            break;
+        case RICEK:       x = randricekf(K,omegarice);          break;
         default:
             fprintf(stderr,"error: %s, unknown/unsupported distribution\n", argv[0]);
             exit(1);
@@ -173,7 +185,15 @@
             index = num_bins-1;

         hist[index]++;
-    }
+
+        // update statistics
+        m1 += x;    // first moment
+        m2 += x*x;  // second moment
+    }
+
+    //
+    m1 /= (float)num_trials;
+    m2 /= (float)num_trials;

     // compute expected distribution
     unsigned int num_steps = 100;
@@ -217,7 +237,73 @@
         }
     }

-    // open output file
+    // print results to screen
+    // find max(hist)
+    unsigned int hist_max = 0;
+    for (i=0; i<num_bins; i++)
+        hist_max = hist[i] > hist_max ? hist[i] : hist_max;
+
+    printf("%8s : %6s [%6s]\n", "x", "count", "prob.");
+    for (i=0; i<num_bins; i++) {
+        printf("%8.2f : %6u [%6.4f]", xmin + i*bin_width, hist[i], (float)hist[i] / (float)num_trials);
+
+        unsigned int k;
+        unsigned int n = round(60 * (float)hist[i] / (float)hist_max);
+        for (k=0; k<n; k++)
+            printf("#");
+        printf("\n");
+    }
+
+    // print distribution info, statistics
+    printf("statistics:\n");
+    switch (distribution) {
+    case UNIFORM:
+        printf("    distribution            :   %s\n", "uniform");
+        break;
+    case NORMAL:
+        printf("    distribution            :   %s\n", "normal (Gauss)");
+        printf("    eta                     :   %f\n", eta);
+        printf("    sigma                   :   %f\n", sigma);
+        break;
+    case EXPONENTIAL:
+        printf("    distribution            :   %s\n", "exponential");
+        printf("    lambda                  :   %f\n", lambda);
+        break;
+    case WEIBULL:
+        printf("    distribution            :   %s\n", "Weibull");
+        printf("    alpha                   :   %f\n", alphaw);
+        printf("    beta                    :   %f\n", betaw);
+        printf("    gamma                   :   %f\n", gammaw);
+        break;
+    case GAMMA:
+        printf("    distribution            :   %s\n", "gamma");
+        printf("    alpha                   :   %f\n", alphag);
+        printf("    beta                    :   %f\n", betag);
+        break;
+    case NAKAGAMIM:
+        printf("    distribution            :   %s\n", "Nakagami-m");
+        printf("    m                       :   %f\n", m);
+        printf("    omega                   :   %f\n", omeganak);
+        break;
+    case RICEK:
+        printf("    distribution            :   %s\n", "Rice-K");
+        printf("    K                       :   %f\n", K);
+        printf("    omega                   :   %f\n", omegarice);
+        break;
+    default:
+        fprintf(stderr,"error: %s, unknown/unsupported distribution\n", argv[0]);
+        exit(1);
+    }
+    printf("\n");
+    printf("    samples                 :   %8lu\n", num_trials);
+    printf("    first moment,  E( x }   :   %8.3f\n", m1);
+    printf("    second moment, E{x^2}   :   %8.3f\n", m2);
+    printf("    variance                :   %8.3f\n", m2 - m1*m1);
+    printf("    standard deviation      :   %8.3f\n", sqrtf(m2 - m1*m1));
+
+    //
+    // export results
+    //
     FILE * fid = fopen(OUTPUT_FILENAME,"w");
     fprintf(fid,"%% %s : auto-generated file\n\n", OUTPUT_FILENAME);
     fprintf(fid,"clear all;\n");


Adjusted names.

Adjusted names.

--- cpu/6502/ipconfig/ipconfig.c
+++ cpu/6502/ipconfig/ipconfig.c
@@ -70,9 +70,9 @@
 static struct ctk_button cancelbutton =
   {CTK_BUTTON(20, 13, 6, "Cancel")};

-PROCESS(dhcp_process, "IP Config");
-
-AUTOSTART_PROCESSES(&dhcp_process);
+PROCESS(ipconfig_process, "IP config");
+
+AUTOSTART_PROCESSES(&ipconfig_process);

 /*-----------------------------------------------------------------------------------*/
 static char *
@@ -170,15 +170,15 @@
 app_quit(void)
 {
   ctk_window_close(&window);
-  process_exit(&dhcp_process);
+  process_exit(&ipconfig_process);
   LOADER_UNLOAD();
 }
 /*-----------------------------------------------------------------------------------*/
-PROCESS_THREAD(dhcp_process, ev, data)
+PROCESS_THREAD(ipconfig_process, ev, data)
 {
   PROCESS_BEGIN();

-  ctk_window_new(&window, 29, 14, "IP Config");
+  ctk_window_new(&window, 29, 14, "IP config");

   CTK_WIDGET_ADD(&window, &requestbutton);
   CTK_WIDGET_ADD(&window, &statuslabel);
@@ -200,7 +200,7 @@
   ctk_window_open(&window);

   /* Allow resolver to set DNS server address. */
-  process_post(PROCESS_CURRENT(), PROCESS_EVENT_MSG, NULL);
+  PROCESS_PAUSE();

   dhcpc_init(uip_ethaddr.addr, sizeof(uip_ethaddr.addr));


Added SPI peripheral header for teensy-lc.

error: pathspec 'cpu/mkl26z64/hal/mkl26-spi.h' did not match any file(s) known to git

--- cpu/mkl26z64/hal/mkl26-spi.h
+++ cpu/mkl26z64/hal/mkl26-spi.h
@@ -0,0 +1,137 @@
+//+------------------------------------------------------------------------------------------------+
+//| SPI peripheral registers for Kinetis MKL26 MCU.                                                |
+//|                                                                                |
+//| Author: Joksan Alvarado.                                                                       |
+//+------------------------------------------------------------------------------------------------+
+
+#ifndef MKL26_SPI_H_
+#define MKL26_SPI_H_
+
+#include <stdint.h>
+
+struct SPI_type {
+  uint8_t S;              //Status register
+  uint8_t BR;             //Baud rate register
+  uint8_t C2;             //Control register 2
+  uint8_t C1;             //Control register 1
+  uint8_t ML;             //Match register low
+  uint8_t MH;             //Match register high
+  uint8_t DL;             //Data register low
+  uint8_t DH;             //Data register high
+  uint8_t CI;             //Clear interrupt register
+  uint8_t C3;             //Control register 3
+};
+
+#define SPI0 ((volatile struct SPI_type *) 0x40076000)
+#define SPI1 ((volatile struct SPI_type *) 0x40077000)
+
+//Status register bitfields
+#define SPI_S_RFIFOEF_Has_Data    (0 << 0)  //SPI read FIFO empty flag
+#define SPI_S_RFIFOEF_Empty       (1 << 0)
+#define SPI_S_TXFULLF_Has_SPace   (0 << 1)  //Transmit FIFO full flag
+#define SPI_S_TXFULLF_Full        (1 << 1)
+#define SPI_S_TNEAREF_Has_Data    (0 << 2)  //Transmit FIFO nearly empty flag
+#define SPI_S_TNEAREF_Near_Empty  (1 << 2)
+#define SPI_S_RNFULLF_Has_Space   (0 << 3)  //Receive FIFO nearly full flag
+#define SPI_S_RNFULLF_Near_Full   (1 << 3)
+#define SPI_S_MODF_Clear          (0 << 4)  //Master mode fault flag
+#define SPI_S_MODF_Set            (1 << 4)
+#define SPI_S_SPTEF_Not_Empty     (0 << 5)  //SPI transmit buffer/FIFO empty flag
+#define SPI_S_SPTEF_Empty         (1 << 5)
+#define SPI_S_SPMF_Clear          (0 << 6)  //SPI match flag
+#define SPI_S_SPMF_Set            (1 << 6)
+#define SPI_S_SPRF_Not_Full       (0 << 7)  //SPI read buffer/FIFO full flag
+#define SPI_S_SPRF_Full           (1 << 7)
+
+//Baud rate register bitfields
+#define SPI_BR_SPR_Msk      0x0F  //SPI baud rate divisor
+#define SPI_BR_SPR_Pos      0
+#define SPI_BR_SPR_Div_2    0
+#define SPI_BR_SPR_Div_4    1
+#define SPI_BR_SPR_Div_8    2
+#define SPI_BR_SPR_Div_16   3
+#define SPI_BR_SPR_Div_32   4
+#define SPI_BR_SPR_Div_64   5
+#define SPI_BR_SPR_Div_128  6
+#define SPI_BR_SPR_Div_256  7
+#define SPI_BR_SPR_Div_512  8
+#define SPI_BR_SPPR_Msk     0x70  //SPI Baud rate prescale divisor
+#define SPI_BR_SPPR_Pos     4
+#define SPI_BR_SPPR_Div_1   0
+#define SPI_BR_SPPR_Div_2   1
+#define SPI_BR_SPPR_Div_3   2
+#define SPI_BR_SPPR_Div_4   3
+#define SPI_BR_SPPR_Div_5   4
+#define SPI_BR_SPPR_Div_6   5
+#define SPI_BR_SPPR_Div_7   6
+#define SPI_BR_SPPR_Div_8   7
+
+//Control register 2 bitfields
+#define SPI_C2_SPC0_Normal          (0 << 0)  //SPI pin control 0
+#define SPI_C2_SPC0_Bidirectional   (1 << 0)
+#define SPI_C2_SPISWAI_Continue     (0 << 1)  //SPI stop in wait mode
+#define SPI_C2_SPISWAI_Stop         (1 << 1)
+#define SPI_C2_RXDMAE_DisDMA_EnIRQ  (0 << 2)  //Receive DMA enable
+#define SPI_C2_RXDMAE_EnDMA_DisIRQ  (1 << 2)
+#define SPI_C2_BIDIROE_Input        (0 << 3)  //Bidirectional mode output enable
+#define SPI_C2_BIDIROE_Output       (1 << 3)
+#define SPI_C2_MODFEN_Disabled      (0 << 4)  //Master mode fault function enable
+#define SPI_C2_MODFEN_Enabled       (1 << 4)
+#define SPI_C2_TXDMAE_DisDMA_EnIRQ  (0 << 5)  //Transmit DMA enable
+#define SPI_C2_TXDMAE_EnDMA_DisIRQ  (1 << 5)
+#define SPI_C2_SPIMODE_8_Bit        (0 << 6)  //SPI 8-bit or 16-bit mode
+#define SPI_C2_SPIMODE_16_Bit       (1 << 6)
+#define SPI_C2_SPMIE_Disabled       (0 << 7)  //SPI match interrupt enable
+#define SPI_C2_SPMIE_Enabled        (1 << 7)
+
+//Control register 1 bitfields
+#define SPI_C1_LSBFE_MSB_First      (0 << 0)  //LSB first (shifter direction)
+#define SPI_C1_LSBFE_LSB_First      (1 << 0)
+#define SPI_C1_SSOE_In_Mode_Fault   (0 << 1)  //Slave select output enable
+#define SPI_C1_SSOE_Out_Auto_SS     (1 << 1)
+#define SPI_C1_CPHA_0               (0 << 2)  //Clock phase
+#define SPI_C1_CPHA_1               (1 << 2)
+#define SPI_C1_CPOL_0               (0 << 3)  //Clock polarity
+#define SPI_C1_CPOL_1               (1 << 3)
+#define SPI_C1_MSTR_Slave           (0 << 4)  //Master/slave mode select
+#define SPI_C1_MSTR_Master          (1 << 4)
+#define SPI_C1_SPTIE_Disabled       (0 << 5)  //SPI transmit interrupt enable
+#define SPI_C1_SPTIE_Enabled        (1 << 5)
+#define SPI_C1_SPE_Disabled         (0 << 6)  //SPI system enable
+#define SPI_C1_SPE_Enabled          (1 << 6)
+#define SPI_C1_SPIE_Disabled        (0 << 7)  //SPI interrupt enable
+#define SPI_C1_SPIE_Enabled         (1 << 7)
+
+//Clear interrupt register bitfields
+#define SPI_CI_SPRFCI_Clear     (0 << 0)  //Receive FIFO full flag clear interrupt
+#define SPI_CI_SPRFCI_Set       (1 << 0)
+#define SPI_CI_SPTEFCI_Clear    (0 << 1)  //Transmit FIFO empty flag clear interrupt
+#define SPI_CI_SPTEFCI_Set      (1 << 1)
+#define SPI_CI_RNFULLFCI_Clear  (0 << 2)  //Receive FIFO nearly full flag clear interrupt
+#define SPI_CI_RNFULLFCI_Set    (1 << 2)
+#define SPI_CI_TNEAREFCI_Clear  (0 << 3)  //Transmit FIFO nearly empty flag clear interrupt
+#define SPI_CI_TNEAREFCI_Set    (1 << 3)
+#define SPI_CI_RXFOF_Clear      (0 << 4)  //Receive FIFO overflow flag
+#define SPI_CI_RXFOF_Set        (1 << 4)
+#define SPI_CI_TXFOF_Clear      (0 << 5)  //Transmit FIFO overflow flag
+#define SPI_CI_TXFOF_Set        (1 << 5)
+#define SPI_CI_RXFERR_Clear     (0 << 6)  //Receive FIFO error flag
+#define SPI_CI_RXFERR_Set       (1 << 6)
+#define SPI_CI_TXFERR_Clear     (0 << 7)  //Transmit FIFO error flag
+#define SPI_CI_TXFERR_Set       (1 << 7)
+
+//Control register 3 bitfields
+#define SPI_C3_FIFOMODE_Disabled      (0 << 0)  //FIFO mode enable
+#define SPI_C3_FIFOMODE_Enabled       (1 << 0)
+#define SPI_C3_RNFULLIEN_Disabled     (0 << 1)  //Receive FIFO nearly full interrupt enable
+#define SPI_C3_RNFULLIEN_Enabled      (1 << 1)
+#define SPI_C3_TNEARIEN_Disabled      (0 << 2)  //Transmit FIFO nearly empty interrupt enable
+#define SPI_C3_TNEARIEN_Enabled       (1 << 2)
+#define SPI_C3_INTCLR_Automatic       (0 << 3)  //Interrupt clearing mechanism select
+#define SPI_C3_INTCLR_Manual          (1 << 3)
+#define SPI_C3_RNFULLF_MARK_48_Bits   (0 << 4)  //Receive FIFO nearly full watermark
+#define SPI_C3_RNFULLF_MARK_32_Bits   (1 << 4)
+#define SPI_C3_TNEAREF_MARK_16_Bits   (0 << 5)  //Transmit FIFO nearly empty watermark
+#define SPI_C3_TNEAREF_MARK_32_Bits   (1 << 5)
+
+#endif //MKL26_SPI_H_


cpu/sam0_common: i2c: fix High Speed

cpu/sam0_common: i2c: fix High Speed

--- cpu/sam0_common/periph/i2c.c
+++ cpu/sam0_common/periph/i2c.c
@@ -122,23 +122,32 @@
     /* Enable Smart Mode (ACK is sent when DATA.DATA is read) */
     bus(dev)->CTRLB.reg = SERCOM_I2CM_CTRLB_SMEN;

-    /* Find and set baudrate. Read speed configuration. Set transfer
-     * speed: SERCOM_I2CM_CTRLA_SPEED(0): Standard-mode (Sm) up to 100
-     * kHz and Fast-mode (Fm) up to 400 kHz */
-    if (i2c_config[dev].speed > I2C_SPEED_FAST) {
+    /* Set SPEED */
+    if (i2c_config[dev].speed > I2C_SPEED_FAST_PLUS) {
         bus(dev)->CTRLA.reg |= SERCOM_I2CM_CTRLA_SPEED(2);
+    } else if (i2c_config[dev].speed > I2C_SPEED_FAST) {
+        bus(dev)->CTRLA.reg |= SERCOM_I2CM_CTRLA_SPEED(1);
     } else {
         bus(dev)->CTRLA.reg |= SERCOM_I2CM_CTRLA_SPEED(0);
     }
+
     /* Get the baudrate */
-    tmp_baud = (int32_t)(((sam0_gclk_freq(i2c_config[dev].gclk_src) +
-               (2 * (i2c_config[dev].speed)) - 1) /
+    /* fSCL = fGCLK / (10 + 2 * BAUD)  -> BAUD   = fGCLK / (2 * fSCL) - 5 */
+    /* fSCL = fGCLK / (2 + 2 * HSBAUD) -> HSBAUD = fGCLK / (2 * fSCL) - 1 */
+    tmp_baud = (((sam0_gclk_freq(i2c_config[dev].gclk_src) +
+               (2 * (i2c_config[dev].speed)) - 1) / /* round up */
                (2 * (i2c_config[dev].speed))) -
-               (i2c_config[dev].speed > I2C_SPEED_FAST ? 1 : 5));
+               (i2c_config[dev].speed > I2C_SPEED_FAST_PLUS ? 1 : 5));
+
     /* Ensure baudrate is within limits */
-    if (tmp_baud < 255 && tmp_baud > 0) {
+    assert(tmp_baud < 255 && tmp_baud > 0);
+
+    if (i2c_config[dev].speed > I2C_SPEED_FAST_PLUS) {
+        bus(dev)->BAUD.reg = SERCOM_I2CM_BAUD_HSBAUD(tmp_baud);
+    } else {
         bus(dev)->BAUD.reg = SERCOM_I2CM_BAUD_BAUD(tmp_baud);
     }
+
     /* ENABLE I2C MASTER */
     _i2c_poweron(dev);


cpu/stm32_common: add low-power modes for stm32f3

--- cpu/stm32_common/periph/pm.c
+++ cpu/stm32_common/periph/pm.c
@@ -40,7 +40,7 @@
  *
  * Available values can be found in reference manual, PWR section, register CR.
  */
-#if defined(CPU_FAM_STM32F0)
+#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3)
 #define PM_STOP_CONFIG  (PWR_CR_LPDS)
 #elif defined(CPU_FAM_STM32L0) || defined(CPU_FAM_STM32L1)
 #define PM_STOP_CONFIG  (PWR_CR_LPSDSR | PWR_CR_ULP)


Change the return type of PVector_hash it should be Py_hash_t rather than long and it fixes tests on win_amd64

--- pvectorcmodule.c
+++ pvectorcmodule.c
@@ -280,7 +280,7 @@
 }

-static long PVector_hash(PVector *self) {
+static Py_hash_t PVector_hash(PVector *self) {
   // Follows the pattern of the tuple hash
   long x, y;
   Py_ssize_t i;


ASoC: Consolidate snd_soc_register_dai() and snd_soc_register_dais()

snd_soc_register_dais() has basically the same code as snd_soc_register_dai(),
but running in a loop. The only difference is that snd_soc_register_dai() calls
fmt_single_name() to generate the DAIs name and snd_soc_register_dais() calls
fmt_multiple_name(). This patch pushes the check in __snd_soc_register_component()
which decides whether to call snd_soc_register_dai() or snd_soc_register_dais()
to snd_soc_register_dais() to decide which naming scheme to use. This allows us
to remove snd_soc_register_dai().

The patch also updates snd_soc_register_dais() to unregister every DAI it finds
for the component rather than trying to unregister one DAI for each DAI that was
registered. Both have the same result since there won't be more DAIs than what
have been registered, but the former is easier to implement.

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>

--- sound/soc/soc-core.c
+++ sound/soc/soc-core.c
@@ -3906,100 +3906,47 @@
 }

 /**
- * snd_soc_register_dai - Register a DAI with the ASoC core
+ * snd_soc_unregister_dai - Unregister DAIs from the ASoC core
+ *
+ * @component: The component for which the DAIs should be unregistered
+ */
+static void snd_soc_unregister_dais(struct snd_soc_component *component)
+{
+	struct snd_soc_dai *dai, *_dai;
+
+	mutex_lock(&client_mutex);
+	list_for_each_entry_safe(dai, _dai, &dai_list, list) {
+		if (dai->dev != component->dev)
+			continue;
+
+		list_del(&dai->list);
+
+		dev_dbg(component->dev, "ASoC: Unregistered DAI '%s'\n",
+			dai->name);
+		kfree(dai->name);
+		kfree(dai);
+	}
+	mutex_unlock(&client_mutex);
+}
+
+/**
+ * snd_soc_register_dais - Register a DAI with the ASoC core
  *
  * @component: The component the DAIs are registered for
  * @dai_drv: DAI driver to use for the DAIs
- */
-static int snd_soc_register_dai(struct snd_soc_component *component,
-		struct snd_soc_dai_driver *dai_drv)
+ * @count: Number of DAIs
+ * @legacy_dai_naming: Use the legacy naming scheme and let the DAI inherit the
+ *                     parent's name.
+ */
+static int snd_soc_register_dais(struct snd_soc_component *component,
+	struct snd_soc_dai_driver *dai_drv, size_t count,
+	bool legacy_dai_naming)
 {
 	struct device *dev = component->dev;
 	struct snd_soc_codec *codec;
 	struct snd_soc_dai *dai;
-
-	dev_dbg(dev, "ASoC: dai register %s\n", dev_name(dev));
-
-	dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL);
-	if (dai == NULL)
-		return -ENOMEM;
-
-	/* create DAI component name */
-	dai->name = fmt_single_name(dev, &dai->id);
-	if (dai->name == NULL) {
-		kfree(dai);
-		return -ENOMEM;
-	}
-
-	dai->component = component;
-	dai->dev = dev;
-	dai->driver = dai_drv;
-	dai->dapm.dev = dev;
-	if (!dai->driver->ops)
-		dai->driver->ops = &null_dai_ops;
-
-	mutex_lock(&client_mutex);
-
-	list_for_each_entry(codec, &codec_list, list) {
-		if (codec->dev == dev) {
-			dev_dbg(dev, "ASoC: Mapped DAI %s to CODEC %s\n",
-				dai->name, codec->name);
-			dai->codec = codec;
-			break;
-		}
-	}
-
-	if (!dai->codec)
-		dai->dapm.idle_bias_off = 1;
-
-	list_add(&dai->list, &dai_list);
-
-	mutex_unlock(&client_mutex);
-
-	dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
-
-	return 0;
-}
-
-/**
- * snd_soc_unregister_dai - Unregister a DAI from the ASoC core
- *
- * @dai: DAI to unregister
- */
-static void snd_soc_unregister_dai(struct device *dev)
-{
-	struct snd_soc_dai *dai;
-
-	list_for_each_entry(dai, &dai_list, list) {
-		if (dev == dai->dev)
-			goto found;
-	}
-	return;
-
-found:
-	mutex_lock(&client_mutex);
-	list_del(&dai->list);
-	mutex_unlock(&client_mutex);
-
-	dev_dbg(dev, "ASoC: Unregistered DAI '%s'\n", dai->name);
-	kfree(dai->name);
-	kfree(dai);
-}
-
-/**
- * snd_soc_register_dais - Register multiple DAIs with the ASoC core
- *
- * @component: The component the DAIs are registered for
- * @dai_drv: DAI driver to use for the DAIs
- * @count: Number of DAIs
- */
-static int snd_soc_register_dais(struct snd_soc_component *component,
-		struct snd_soc_dai_driver *dai_drv, size_t count)
-{
-	struct device *dev = component->dev;
-	struct snd_soc_codec *codec;
-	struct snd_soc_dai *dai;
-	int i, ret = 0;
+	unsigned int i;
+	int ret;

 	dev_dbg(dev, "ASoC: dai register %s #%Zu\n", dev_name(dev), count);

@@ -4011,21 +3958,32 @@
 			goto err;
 		}

-		/* create DAI component name */
-		dai->name = fmt_multiple_name(dev, &dai_drv[i]);
+		/*
+		 * Back in the old days when we still had component-less DAIs,
+		 * instead of having a static name, component-less DAIs would
+		 * inherit the name of the parent device so it is possible to
+		 * register multiple instances of the DAI. We still need to keep
+		 * the same naming style even though those DAIs are not
+		 * component-less anymore.
+		 */
+		if (count == 1 && legacy_dai_naming) {
+			dai->name = fmt_single_name(dev, &dai->id);
+		} else {
+			dai->name = fmt_multiple_name(dev, &dai_drv[i]);
+			if (dai_drv[i].id)
+				dai->id = dai_drv[i].id;
+			else
+				dai->id = i;
+		}
 		if (dai->name == NULL) {
 			kfree(dai);
-			ret = -EINVAL;
+			ret = -ENOMEM;
 			goto err;
 		}

 		dai->component = component;
 		dai->dev = dev;
 		dai->driver = &dai_drv[i];
-		if (dai->driver->id)
-			dai->id = dai->driver->id;
-		else
-			dai->id = i;
 		dai->dapm.dev = dev;
 		if (!dai->driver->ops)
 			dai->driver->ops = &null_dai_ops;
@@ -4034,8 +3992,7 @@

 		list_for_each_entry(codec, &codec_list, list) {
 			if (codec->dev == dev) {
-				dev_dbg(dev,
-					"ASoC: Mapped DAI %s to CODEC %s\n",
+				dev_dbg(dev, "ASoC: Mapped DAI %s to CODEC %s\n",
 					dai->name, codec->name);
 				dai->codec = codec;
 				break;
@@ -4049,30 +4006,15 @@

 		mutex_unlock(&client_mutex);

-		dev_dbg(dai->dev, "ASoC: Registered DAI '%s'\n", dai->name);
+		dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
 	}

 	return 0;

 err:
-	for (i--; i >= 0; i--)
-		snd_soc_unregister_dai(dev);
+	snd_soc_unregister_dais(component);

 	return ret;
-}
-
-/**
- * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core
- *
- * @dai: Array of DAIs to unregister
- * @count: Number of DAIs
- */
-static void snd_soc_unregister_dais(struct device *dev, size_t count)
-{
-	int i;
-
-	for (i = 0; i < count; i++)
-		snd_soc_unregister_dai(dev);
 }

 /**
@@ -4106,19 +4048,7 @@
 	cmpnt->dai_drv	= dai_drv;
 	cmpnt->num_dai	= num_dai;

-	/*
-	 * snd_soc_register_dai()  uses fmt_single_name(), and
-	 * snd_soc_register_dais() uses fmt_multiple_name()
-	 * for dai->name which is used for name based matching
-	 *
-	 * this function is used from cpu/codec.
-	 * allow_single_dai flag can ignore "codec" driver reworking
-	 * since it had been used snd_soc_register_dais(),
-	 */
-	if ((1 == num_dai) && allow_single_dai)
-		ret = snd_soc_register_dai(cmpnt, dai_drv);
-	else
-		ret = snd_soc_register_dais(cmpnt, dai_drv, num_dai);
+	ret = snd_soc_register_dais(cmpnt, dai_drv, num_dai, allow_single_dai);
 	if (ret < 0) {
 		dev_err(dev, "ASoC: Failed to regster DAIs: %d\n", ret);
 		goto error_component_name;
@@ -4173,7 +4103,7 @@
 	return;

 found:
-	snd_soc_unregister_dais(dev, cmpnt->num_dai);
+	snd_soc_unregister_dais(cmpnt);

 	mutex_lock(&client_mutex);
 	list_del(&cmpnt->list);


ASoC: dapm: Ensure power gets managed for line widgets

Line widgets had not been included in either the power up or power down
sequences so if a widget had an event associated with it that event would
never be run. Fix this minimally by adding them to the sequences, we
should probably be doing away with the specific widget types as they all
have the same priority anyway.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org

--- sound/soc/soc-dapm.c
+++ sound/soc/soc-dapm.c
@@ -67,6 +67,7 @@
 	[snd_soc_dapm_out_drv] = 10,
 	[snd_soc_dapm_hp] = 10,
 	[snd_soc_dapm_spk] = 10,
+	[snd_soc_dapm_line] = 10,
 	[snd_soc_dapm_post] = 11,
 };

@@ -75,6 +76,7 @@
 	[snd_soc_dapm_adc] = 1,
 	[snd_soc_dapm_hp] = 2,
 	[snd_soc_dapm_spk] = 2,
+	[snd_soc_dapm_line] = 2,
 	[snd_soc_dapm_out_drv] = 2,
 	[snd_soc_dapm_pga] = 4,
 	[snd_soc_dapm_mixer_named_ctl] = 5,


simplify

simplify

--- explore/1649-f103/serplus/serplus.c
+++ explore/1649-f103/serplus/serplus.c
@@ -190,7 +190,7 @@

 /* telnet escape codes and special values: */
 enum {
-    IAC=255, WILL=251, DONT=254, SB=250, SE=240,
+    IAC=255, WILL=251, SB=250, SE=240,
     CPO=44, SETPAR=3, SETCTL=5,
     PAR_NONE=1, PAR_ODD=2, PAR_EVEN=3,
     DTR_ON=8, DTR_OFF=9, RTS_ON=11, RTS_OFF=12,
@@ -240,8 +240,7 @@
                     if (data == IAC)
                         usart_send(USART1, data);
                     else
-                        state = data == SB ? 3 :
-                                WILL <= data && data <= DONT ? 2 : 0;
+                        state = data == SB ? 3 : data >= WILL ? 2 : 0;
                     break;

                 case 2: // IAC, WILL (or WONT/DO/DONT) seen


Fix more compilation problems with native_support on Ruby 1.8.7

--- ext/ruby/passenger_native_support.c
+++ ext/ruby/passenger_native_support.c
@@ -863,7 +863,7 @@
 Init_passenger_native_support() {
 	struct sockaddr_un addr;

-	// Only defined on Ruby >= 1.9
+	/* Only defined on Ruby >= 1.9 */
 	#ifdef RUBY_API_VERSION_CODE
 		if (ruby_api_version[0] != RUBY_API_VERSION_MAJOR
 		 || ruby_api_version[1] != RUBY_API_VERSION_MINOR
@@ -880,10 +880,11 @@
 			fprintf(stderr, "     Refusing to load existing passenger_native_support.\n");
 			return;
 		}
-		// Because native extensions may be linked to libruby, loading
-		// a Ruby 1.9 native extension may not fail on Ruby 1.8 (even though
-		// the extension will crash later on). We detect such a case here and
-		// abort early.
+		/* Because native extensions may be linked to libruby, loading
+		 * a Ruby 1.9 native extension may not fail on Ruby 1.8 (even though
+		 * the extension will crash later on). We detect such a case here and
+		 * abort early.
+		 */
 		if (strlen(ruby_version) >= sizeof("1.8.7") - 1
 		 && ruby_version[0] == '1'
 		 && ruby_version[1] == '.'
@@ -898,15 +899,23 @@
 			return;
 		}
 	#else
-		printf("here 2!\n");
 		if (strlen(ruby_version) < sizeof("1.8.7") - 1
 		 || ruby_version[0] != '1'
 		 || ruby_version[1] != '.'
 		 || ruby_version[2] != '8')
 		{
+			/* We may not have included Ruby 1.8's version.h because of compiler
+			 * header file search paths, so we can't rely on RUBY_VERSION being
+			 * defined.
+			 */
+			#ifdef RUBY_VERSION
+				#define ESTIMATED_RUBY_VERSION RUBY_VERSION
+			#else
+				#define ESTIMATED_RUBY_VERSION "1.8"
+			#endif
 			fprintf(stderr, " --> passenger_native_support was compiled for Ruby %s, "
 				"but you're currently running Ruby %s\n",
-				RUBY_VERSION, ruby_version);
+				ESTIMATED_RUBY_VERSION, ruby_version);
 			fprintf(stderr, "     Refusing to load existing passenger_native_support.\n");
 			return;
 		}


Fixed memory leak on GetColorVV, but since I'm not sure how it's used, I'm unsure if the method returning byte[] is correct. The method returning bool should always work though.

--- Ultrasonix.Porta/Ultrasonix.Porta.h
+++ Ultrasonix.Porta/Ultrasonix.Porta.h
@@ -719,15 +719,28 @@
 					return po->getColorData(index, d, velocity, prescan, copy);
 				}

-				IntPtr GetColorVV(int index)
-				{
-					// TODO: Is this correct?
-					const int size = 640*480 * 4;
-					unsigned char* data = new unsigned char[size];
-
-					po->getColorVV(index, data);
-
-					return IntPtr(data);
+				array<Byte>^ GetColorVV(int index)
+				{
+					int size = 640*480*4;
+
+					array<Byte>^ arr = gcnew array<Byte>(size);
+					pin_ptr<Byte> p = &arr[0];
+					unsigned char* data = p;
+
+					bool result = po->getColorVV(index, data);
+
+					if (result == false)
+					{
+						throw gcnew PortaImagingException("GetColorImage failed to retrieve an image");
+					}
+
+					return arr;
+				}
+
+				bool GetColorVV(int index, IntPtr data)
+				{
+					unsigned char* d = (unsigned char*)data.ToPointer();
+					return po->getColorVV(index, d);
 				}

 				int GetDisplayFrameCount(int index)


make it obvious

make it obvious

--- slashd/up_sched_res.c
+++ slashd/up_sched_res.c
@@ -263,7 +263,6 @@
 	q.bno = b->bcm_bmapno;
 	BHGEN_GET(b, &q.bgen);
 	q.src_resid = src_resm->resm_res_id;
-	q.len = SLASH_BMAP_SIZE;
 	lastbno = fcmh_nvalidbmaps(f);
 	if (lastbno > 0)
 		lastbno--;
@@ -277,7 +276,8 @@
 			PFL_GOTOERR(out, rc = -ENODATA);

 		q.len = MIN(sz, SLASH_BMAP_SIZE);
-	}
+	} else
+		q.len = SLASH_BMAP_SIZE;

 	brepls_init(tract, -1);
 	tract[BREPLST_REPL_QUEUED] = BREPLST_REPL_SCHED;


Fix #8 issue that THM3060 anticollision algorithm always switch to TypeA mode.

--- source/mcu/v1/main.c
+++ source/mcu/v1/main.c
@@ -85,7 +85,8 @@

 	while(1)
  	{
-
+
+	  write_reg(PSEL,0x00);//reset default mode to TypeB
 	  #ifndef IAP_ENABLED
 	  //step 1:read uart1
 	  len = uart1_read(buf,MAX_BUFSIZE);


clean it

clean it

--- source/myhtml/tree.c
+++ source/myhtml/tree.c
@@ -307,6 +307,7 @@
     tree_node->parent        = 0;
     tree_node->last_child    = 0;
     tree_node->token         = 0;
+    tree_node->data          = NULL;
     tree_node->ns            = MyHTML_NAMESPACE_HTML;
 }


adding proxy namespace to doxygen docu

adding proxy namespace to doxygen docu

--- source/proxy/proxy.h
+++ source/proxy/proxy.h
@@ -19,6 +19,7 @@
     class response_header;
 }

+/** @namespace proxy */
 namespace proxy
 {
     /**


Servidor concurrente para aceptar mas de una conexion

error: pathspec 'source/socket_fork.c' did not match any file(s) known to git

--- source/socket_fork.c
+++ source/socket_fork.c
@@ -0,0 +1,89 @@
+//Servidor concurrente para atender mas de una conexion
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+//Funcion para procesar al nuevo cliente conectado
+void procesar (int sock)
+{
+	int n;
+	char buffer[256];
+	bzero(buffer,256);
+	//Se lee del nuevo socket, se verifica si hay error
+	n = read(sock,buffer,255);
+	if (n < 0)
+	{
+		perror("Error al leer del socket");
+		exit(1);
+	}
+	//Se imprime el mensaje que envio el socket
+	printf("Mensaje del socket: %s\n",buffer);
+	//Se devuelve una cadena como respuesta al socket y se verifica si hay error
+	n = write(sock,"Respuesta a socket",18);
+	if (n < 0)
+	{
+		perror("Error al escribir en el socket");
+		exit(1);
+	}
+}
+
+int main(int argc, char *argv[])
+{
+	struct sockaddr_in sockaddr, clientaddr;	//Estructuras para almacenar la info del socket
+	int s;						//Socket principal
+	int ns;						//Socket que se crea despues del accept()
+	int pid;					//Idetificador de procesos fork()
+	int len;					//Longitud de estrucutras
+	int portno = 5001;				//Puerto de comunicacion
+	//Se abre el socket y se verifican errores
+	if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+		perror("Error al crear socket");
+	//Inicializar estructura del socket
+	memset(&sockaddr,'0',sizeof(sockaddr));
+	sockaddr.sin_family = AF_INET;
+	sockaddr.sin_port = htons(portno);
+	sockaddr.sin_addr.s_addr = INADDR_ANY;
+	//Definimos la longitud de la estructura
+	len=sizeof(sockaddr);
+	//Se liga al socket usando bind y se verifican errores
+	if (bind(s, (struct sockaddr *)&sockaddr, len) < 0)
+		perror("Error en el bind");
+	//Señal para ignorar la terminacion de cada hijo
+	signal(SIGCHLD, SIG_IGN);
+	//Se coloca al socket en modo pasivo a la espera de conexiones y se verifican errores
+	if (listen(s,10) < 0)
+		perror("Eror en el listen");
+	//Ciclo infinito para aceptar conexiones
+	while(1)
+	{
+		//Longitud de ls estructura
+		len=sizeof(clientaddr);
+		//Se espera por conexiones, se bloquea hasta que ocurre alguna
+		if ((ns = accept(s,(struct sockaddr *)&clientaddr,&len)) < 0)
+			perror("Error en el accept");
+		//Se crea un proceso hijo por cada conexion entrante
+		//Se verifica por algun error en fork()
+		if((pid = fork()) < 0)
+		{
+			perror("Error en fork");
+			exit(1);
+		}
+		//El proceso hijo atiende la nuevo conexion
+		if(pid == 0)
+		{
+			//Se llama a la funcion que procesara los datos
+			procesar(ns);
+			exit(0);
+		}
+		//Proceso padre cierra el nuevo socket y queda en espera de mas conexiones
+		else
+			close(ns);
+	}
+	return(0);
+}


irrelevize_subsumption_order: clarify comment

"Caveat" was a bit strong given that it makes no difference in terms of
correctness.

--- space/place-box.98.c
+++ space/place-box.98.c
@@ -615,17 +615,16 @@
 // Where X is the final box placed. Note that * is now found in B, not in X,
 // but its data was in C (now X)! Oops!
 //
-// So, we do the following, which in the above case would copy the data from C
-// to B.
+// So, we do this, which in the above case would copy the data from C to B.
 //
 // Since mushspace_get_tight_bounds checks all boxes without considering
 // overlappingness, we also space the overlapped area in C to prevent mishaps
 // there.
 //
-// Caveat: this assumes that the final box will always be placed bottom-most.
-// This does not really matter, it's just extra work if it's not; but in any
-// case, if not, the relevant overlapping boxes would be those which would end
-// up above the final box.
+// Note: this assumes that the final box will always be placed bottom-most.
+// This does not really matter, as it's just extra work if it's not. But if
+// not, we only need to consider, of the boxes that overlap with the subsumees,
+// those which would end up above the final box.
 static void irrelevize_subsumption_order(
    mushspace* space, musharr_size_t subsumees)
 {


prepare flon-tasker pending specs

prepare flon-tasker pending specs

--- spec/t/tasker_spec.c
+++ spec/t/tasker_spec.c
@@ -93,6 +93,9 @@
       flu_unlink("var/spool/dis/ret_%s-%s.json", exid, nid);
     }

+    it "moves non-identifiable tasks to var/spool/rejected/"
+    it "moves non-parseable tasks to var/spool/rejected/"
+
     it "returns the task as failed if it can't find the taskee"
     {
       exid = flon_generate_exid("ttest.cant_find_taskee");
@@ -127,6 +130,9 @@
       expect(fdja_ld(v, "on") ===f "offer");
       expect(fdja_ld(v, "payload") ===f "{ hello: world }");
     }
+
+    it "returns the task as failed if the taskee doesn't have a flon.json"
+    it "returns the task as failed if the taskee doesn't have 'run' key"
   }

   describe "flon_lookup_tasker()"


Added format specifiers for printf with int64_t, uint64_t, int32_t and uint32_t

git-svn-id: fbb392d5347ebc45c06187f72dfd8bab02595dbf@620175 13f79535-47bb-0310-9956-ffa450edef68

--- util/include/axutil_utils_defines.h
+++ util/include/axutil_utils_defines.h
@@ -44,6 +44,28 @@
     typedef __int64 int64_t;
 #endif

+/**
+ * Definition of format specifiers
+ * for printf family of functions
+ */
+
+#if defined(WIN32)
+#define AXIS2_PRINTF_FORMAT_INT64 "%I64d"
+#define AXIS2_PRINTF_FORMAT_UINT64 "%I64u"
+#define AXIS2_PRINTF_FORMAT_INT32 "%I32d"
+#define AXIS2_PRINTF_FORMAT_UINT32 "%I32u"
+#else
+#if __WORDSIZE == 64
+#define AXIS2_PRINTF_FORMAT_INT64 "%ld"
+#define AXIS2_PRINTF_FORMAT_UINT64 "%lu"
+#else
+#define AXIS2_PRINTF_FORMAT_INT64 "%lld"
+#define AXIS2_PRINTF_FORMAT_UINT64 "%llu"
+#endif
+#define AXIS2_PRINTF_FORMAT_INT32 "%d"
+#define AXIS2_PRINTF_FORMAT_UINT32 "%u"
+#endif
+
     /**
       * Type definitions
       */


Struct pointer function updates

Struct pointer function updates

git-svn-id: 71a243ed375c9908d11e7cf355a3dd3ac3c70cbb@179 e624367d-d6e4-4977-a939-15c673ed3205

--- src-IL/src/il_jpeg.c
+++ src-IL/src/il_jpeg.c
@@ -283,14 +283,15 @@
 // this function is called. The caller must call jpeg_finish_decompress because
 // the caller may still need decompressor after calling this for e.g. examining
 // saved markers.
-ILboolean ILAPIENTRY ilLoadFromJpegStruct(j_decompress_ptr JpegInfo)
+ILboolean ILAPIENTRY ilLoadFromJpegStruct(ILvoid *_JpegInfo)
 {
 	// sam. void (*errorHandler)(j_common_ptr);
 	ILubyte *TempPtr[1];
+	j_decompress_ptr JpegInfo = (j_decompress_ptr)_JpegInfo;

 	// sam. errorHandler = JpegInfo->err->error_exit;
 	// sam. JpegInfo->err->error_exit = ExitErrorHandle;
-	jpeg_start_decompress(JpegInfo);
+	jpeg_start_decompress((j_decompress_ptr)JpegInfo);

 	if (!ilTexImage(JpegInfo->output_width, JpegInfo->output_height, 1, (ILubyte)JpegInfo->output_components, 0, IL_UNSIGNED_BYTE, NULL)) {
 		return IL_FALSE;
@@ -488,12 +489,13 @@
 // is also responsible for calling jpeg_finish_compress in case the
 // caller still needs to compressor for something.
 //
-ILboolean ILAPIENTRY ilSaveFromJpegStruct(j_compress_ptr JpegInfo)
+ILboolean ILAPIENTRY ilSaveFromJpegStruct(ILvoid *_JpegInfo)
 {
 	void (*errorHandler)(j_common_ptr);
 	JSAMPROW	row_pointer[1];
 	ILimage		*Temp;
 	ILenum		Origin;
+	j_compress_ptr JpegInfo = (j_compress_ptr)_JpegInfo;

 	if (iCurImage == NULL) {
 		ilSetError(IL_ILLEGAL_OPERATION);


CrH_GFX3: 使用更精确的包尾球计算方法

CrH_GFX3: 使用更精确的包尾球计算方法

--- src/CrH_GFX3/bound.c
+++ src/CrH_GFX3/bound.c
@@ -137,25 +137,112 @@
   __CR_IN__ leng_t          bpv
     )
 {
-    fp32_t      radius;
-    fp32_t      xx, yy, zz;
-    vec3d_t     min, max;
-
-    bound_min_max(&min, &max, pos, count, bpv);
-
-    ball->center.x = (min.x + max.x) / 2.0f;
-    ball->center.y = (min.y + max.y) / 2.0f;
-    ball->center.z = (min.z + max.z) / 2.0f;
-
-    ball->radius = -1.0f;
-    for (; count != 0; count--) {
-        xx = ball->center.x - pos->x;
-        yy = ball->center.y - pos->y;
-        zz = ball->center.z - pos->z;
-        radius = FSQRT(xx * xx + yy * yy + zz * zz);
-        if (radius > ball->radius)
-            ball->radius = radius;
+    leng_t          idx;
+    const vec3d_t*  ptr;
+    /* -------------- */
+    fp32_t  min_x, min_y, min_z;
+    fp32_t  max_x, max_y, max_z;
+    leng_t  idx_min_x, idx_min_y, idx_min_z;
+    leng_t  idx_max_x, idx_max_y, idx_max_z;
+
+    ptr = pos;
+    min_x = max_x = ptr->x;
+    min_y = max_y = ptr->y;
+    min_z = max_z = ptr->z;
+    idx_min_x = idx_min_y = idx_min_z = 0;
+    idx_max_x = idx_max_y = idx_max_z = 0;
+    ptr = (vec3d_t*)((byte_t*)ptr + bpv);
+    for (idx = 1; idx < count; idx++) {
+        if (ptr->x < min_x) { min_x = ptr->x; idx_min_x = idx; }
+        if (ptr->y < min_y) { min_y = ptr->y; idx_min_y = idx; }
+        if (ptr->z < min_z) { min_z = ptr->z; idx_min_z = idx; }
+        if (ptr->x > max_x) { max_x = ptr->x; idx_max_x = idx; }
+        if (ptr->y > max_y) { max_y = ptr->y; idx_max_y = idx; }
+        if (ptr->z > max_z) { max_z = ptr->z; idx_max_z = idx; }
+        ptr = (vec3d_t*)((byte_t*)ptr + bpv);
+    }
+
+    idx = idx_max_x * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x = ptr->x;
+    max_y = ptr->y;
+    max_z = ptr->z;
+    idx = idx_min_x * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x -= ptr->x;
+    max_y -= ptr->y;
+    max_z -= ptr->z;
+    min_x = max_x * max_x + max_y * max_y + max_z * max_z;
+
+    idx = idx_max_y * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x = ptr->x;
+    max_y = ptr->y;
+    max_z = ptr->z;
+    idx = idx_min_y * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x -= ptr->x;
+    max_y -= ptr->y;
+    max_z -= ptr->z;
+    min_y = max_x * max_x + max_y * max_y + max_z * max_z;
+
+    idx = idx_max_z * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x = ptr->x;
+    max_y = ptr->y;
+    max_z = ptr->z;
+    idx = idx_min_z * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    max_x -= ptr->x;
+    max_y -= ptr->y;
+    max_z -= ptr->z;
+    min_z = max_x * max_x + max_y * max_y + max_z * max_z;
+
+    if (zz > xx && zz > yy) {
+        ball->radius = min_z;
+        idx_max_x = idx_max_z;
+        idx_min_x = idx_min_z;
+    }
+    else
+    if (yy > xx && yy > zz) {
+        ball->radius = min_y;
+        idx_max_x = idx_max_y;
+        idx_min_x = idx_min_y;
+    }
+    else {
+        ball->radius = min_x;
+    }
+    idx = idx_max_x * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    ball->center.x = ptr->x;
+    ball->center.y = ptr->y;
+    ball->center.z = ptr->z;
+    idx = idx_min_x * bpv;
+    ptr = (vec3d_t*)((byte_t*)pos + idx);
+    ball->center.x += ptr->x;
+    ball->center.y += ptr->y;
+    ball->center.z += ptr->z;
+    ball->center.x *= 0.5f;
+    ball->center.y *= 0.5f;
+    ball->center.z *= 0.5f;
+    ball->radius = FSQRT(ball->radius) * 0.5f;
+    min_y = ball->radius * ball->radius;
+
+    for (idx = 0; idx < count; idx++) {
+        max_x = ball->center.x - pos->x;
+        max_y = ball->center.y - pos->y;
+        max_z = ball->center.z - pos->z;
         pos = (vec3d_t*)((byte_t*)pos + bpv);
+        min_x = max_x * max_x + max_y * max_y + max_z * max_z;
+        if (min_x > min_y) {
+            min_x = FSQRT(min_x);
+            min_z = (min_x + ball->radius) * 0.5f;
+            min_x = (min_z - ball->radius) / min_x;
+            ball->radius = min_z;
+            ball->center.x += max_x * min_x;
+            ball->center.y += max_y * min_x;
+            ball->center.z += max_z * min_x;
+        }
     }
 }


Missed one pthread_create.

Missed one pthread_create.

--- KERN/usrsctp/programs/ekr_client.c
+++ KERN/usrsctp/programs/ekr_client.c
@@ -145,9 +145,11 @@
 	}
 	usrsctp_init(0, conn_output);
 	usrsctp_sysctl_set_sctp_debug_on(0x0);
-	if (pthread_create(&tid, NULL, &handle_packets, (void *)&fd) != 0) {
-		printf("pthread_create failed\n");
-	}
+#if defined(__Userspace_os_Windows)
+	tid = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&handle_packets, (void *)&fd, 0, NULL);
+#else
+	pthread_create(&tid, NULL, &handle_packets, (void *)&fd);
+#endif
 	if ((s = usrsctp_socket(AF_CONN, SOCK_STREAM, IPPROTO_SCTP, receive_cb, NULL, 0, NULL)) == NULL) {
 		perror("usrsctp_socket");
 	}


Substitute extraneous underscores with spaces.

--- src/backend/utils/adt/arrayfuncs.c
+++ src/backend/utils/adt/arrayfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.155 2009/04/09 17:39:48 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.156 2009/04/15 23:30:33 alvherre Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -4492,7 +4492,7 @@
 	if (ARR_LBOUND(dims)[0] != 1)
 		ereport(ERROR,
 			    (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
-			     errmsg("wrong range of array_subscripts"),
+			     errmsg("wrong range of array subscripts"),
 			     errdetail("Lower bound of dimension array must be one.")));

 	if (ARR_HASNULL(dims))
@@ -4524,7 +4524,7 @@
 		if (ARR_LBOUND(lbs)[0] != 1)
 			ereport(ERROR,
 				(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
-			         errmsg("wrong range of array_subscripts"),
+			         errmsg("wrong range of array subscripts"),
 			    	 errdetail("Lower bound of dimension array must be one.")));

 		if (ARR_HASNULL(lbs))
@@ -4535,7 +4535,7 @@
 		if (ARR_DIMS(lbs)[0] != ndims)
 			ereport(ERROR,
 				    (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
-				     errmsg("wrong number of array_subscripts"),
+				     errmsg("wrong number of array subscripts"),
 				     errdetail("Low bound array has different size than dimensions array.")));

 		lbsv = (int *) ARR_DATA_PTR(lbs);


Fix to_number() to correctly ignore thousands separator when it's '.'.

The existing code in NUM_numpart_from_char has hard-wired logic to treat
'.' as decimal point, even when we're using a locale-aware format string
and the locale says that '.' is the thousands separator.  This results in
clearly wrong answers in FM mode (where we must be able to identify the
decimal point location), as per bug report from Patryk Kordylewski.

Since the initialization code in NUM_prepare_locale already sets up
Np->decimal as either the locale decimal-point string or "." depending
on which decimal-point format code was used, there's really no need to
have any extra logic at all in NUM_numpart_from_char: we only need to
test for a match to Np->decimal.

(Note: AFAICS there's nothing in here that explicitly checks for thousands
separators --- rather, any unmatched character is silently skipped over.
That's pretty bogus IMO but it's not the issue being complained of.)

This is a longstanding bug, but it's possible that some existing apps
are depending on '.' being recognized as decimal point even when using
a D format code.  Hence, no back-patch.  We should probably list this
as a potential incompatibility in the 9.3 release notes.

--- src/backend/utils/adt/formatting.c
+++ src/backend/utils/adt/formatting.c
@@ -4131,7 +4131,7 @@
 #endif

 	/*
-	 * read digit
+	 * read digit or decimal point
 	 */
 	if (isdigit((unsigned char) *Np->inout_p))
 	{
@@ -4151,39 +4151,27 @@
 #ifdef DEBUG_TO_FROM_CHAR
 		elog(DEBUG_elog_output, "Read digit (%c)", *Np->inout_p);
 #endif
-
+	}
+	else if (IS_DECIMAL(Np->Num) && Np->read_dec == FALSE)
+	{
 		/*
-		 * read decimal point
+		 * We need not test IS_LDECIMAL(Np->Num) explicitly here, because
+		 * Np->decimal is always just "." if we don't have a D format token.
+		 * So we just unconditionally match to Np->decimal.
 		 */
-	}
-	else if (IS_DECIMAL(Np->Num) && Np->read_dec == FALSE)
-	{
+		int			x = strlen(Np->decimal);
+
 #ifdef DEBUG_TO_FROM_CHAR
-		elog(DEBUG_elog_output, "Try read decimal point (%c)", *Np->inout_p);
+		elog(DEBUG_elog_output, "Try read decimal point (%c)",
+			 *Np->inout_p);
 #endif
-		if (*Np->inout_p == '.')
-		{
+		if (x && AMOUNT_TEST(x) && strncmp(Np->inout_p, Np->decimal, x) == 0)
+		{
+			Np->inout_p += x - 1;
 			*Np->number_p = '.';
 			Np->number_p++;
 			Np->read_dec = TRUE;
 			isread = TRUE;
-		}
-		else
-		{
-			int			x = strlen(Np->decimal);
-
-#ifdef DEBUG_TO_FROM_CHAR
-			elog(DEBUG_elog_output, "Try read locale point (%c)",
-				 *Np->inout_p);
-#endif
-			if (x && AMOUNT_TEST(x) && strncmp(Np->inout_p, Np->decimal, x) == 0)
-			{
-				Np->inout_p += x - 1;
-				*Np->number_p = '.';
-				Np->number_p++;
-				Np->read_dec = TRUE;
-				isread = TRUE;
-			}
 		}
 	}


Allow system to start up, even if pg_auth_time_constraint is corrupt.

If pg_auth_time_constraint contains a role OID that doesn't exist in
pg_authid, we used to crash at system startup. A corrupt catalog table
is not good, but refusing to start up is even worse. Make
write_auth_time_file() function more resilient, and throw a warning
in that situation, and avoid the crash. The crash happened in the
pq_qsort() after this loop, because time_name_compar expects every
authtime_entry being sorted to have a valid non-NULL role name.

--- src/backend/utils/init/flatfiles.c
+++ src/backend/utils/init/flatfiles.c
@@ -835,6 +835,22 @@
 							(errmsg("time constraints are being added against superuser")));
 				authtime_info[curr_constraint].rolname = found_role->rolname;
 			}
+			else
+			{
+				/*
+				 * pg_auth_time_constraint or pg_authid is corrupt: a role mentioned in
+				 * pg_auth_time_constraint was not found in pg_authid. Remove the entry
+				 * from the array so that we can start up the system.
+				 */
+				ereport(WARNING,
+						(errmsg("role with OID %u mentioned in pg_auth_time_constraint does not exist",
+								authtime_info[curr_constraint].roleid)));
+				total_constraints--;
+				memmove(&authtime_info[curr_constraint],
+						&authtime_info[curr_constraint + 1],
+						total_constraints - curr_constraint);
+				curr_constraint--;
+			}
 		}
 	}


Update comment.

Update comment.

The _bt_tuplecompare() function mentioned in comment hasn't existed for a
long time.

Peter Geoghegan

--- src/backend/utils/sort/tuplesort.c
+++ src/backend/utils/sort/tuplesort.c
@@ -3176,9 +3176,8 @@
 					   Tuplesortstate *state)
 {
 	/*
-	 * This is similar to _bt_tuplecompare(), but we have already done the
-	 * index_getattr calls for the first column, and we need to keep track of
-	 * whether any null fields are present.  Also see the special treatment
+	 * This is similar to comparetup_heap(), but expects index tuples.  There
+	 * is also special handling for enforcing uniqueness, and special treatment
 	 * for equal keys at the end.
 	 */
 	ScanKey		scanKey = state->indexScanKey;


Put a framelist around the icon list widget in Basic mode.

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@27264 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/bin/e_int_config_icon_themes.c
+++ src/bin/e_int_config_icon_themes.c
@@ -110,7 +110,6 @@
    free(cfdata);
 }

-
 static int
 _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
@@ -125,7 +124,6 @@
    if ((a) && (a->func.go)) a->func.go(NULL, NULL);
    return 1; /* Apply was OK */
 }
-

 static void
 _cb_button_up(void *data1, void *data2)
@@ -159,7 +157,6 @@
    if (cfdata->gui.o_frame)
      e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
 }
-

 static Evas_Object *
 _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
@@ -283,15 +280,15 @@
    return o;
 }

-
 static Evas_Object *
 _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
 {
-   Evas_Object *o, *ilist;
+   Evas_Object *o, *ilist, *of;
    Evas_List *l;
    int i;

    o = e_widget_list_add(evas, 1, 0);
+   of = e_widget_framelist_add(evas, _("Icon Themes"), 0);
    ilist = e_widget_ilist_add(evas, 24, 24, &(cfdata->themename));
    cfdata->gui.list = ilist;
    e_widget_on_change_hook_set(ilist, _ilist_cb_change, cfdata);
@@ -333,8 +330,9 @@
    e_widget_ilist_thaw(ilist);
    edje_thaw();
    evas_event_thaw(evas_object_evas_get(ilist));
-
-   e_widget_list_object_append(o, ilist, 1, 1, 0.5);
+
+   e_widget_framelist_object_append(of, ilist);
+   e_widget_list_object_append(o, of, 1, 1, 0.5);

    e_dialog_resizable_set(cfd->dia, 1);

@@ -402,7 +400,6 @@
       }
 }

-
 static int
 _sort_icon_themes(void *data1, void *data2)
 {


Add ability to have seperate NumLock key bindings for on & off states.

SVN revision: 27417

--- src/bin/e_int_config_keybindings.c
+++ src/bin/e_int_config_keybindings.c
@@ -910,7 +910,7 @@
    if (bi2->modifiers & E_BINDING_MODIFIER_ALT) j++;
    if (bi2->modifiers & E_BINDING_MODIFIER_SHIFT) j++;
    if (bi2->modifiers & E_BINDING_MODIFIER_WIN) j++;
-
+
    if (i < j) return -1;
    else if (i > j) return 1;

@@ -1004,7 +1004,7 @@
    cfdata = data;

    if (ev->win != cfdata->locals.bind_win) return 1;
-
+
    if (!strcmp(ev->keyname, "Escape") &&
        !(ev->modifiers & ECORE_X_MODIFIER_SHIFT) &&
        !(ev->modifiers & ECORE_X_MODIFIER_CTRL) &&
@@ -1041,7 +1041,9 @@
 	       mod |= E_BINDING_MODIFIER_ALT;
 	     if (ev->modifiers & ECORE_X_MODIFIER_WIN)
 	       mod |= E_BINDING_MODIFIER_WIN;
-
+	     if (ev->modifiers & ECORE_X_LOCK_NUM)
+	       mod |= ECORE_X_LOCK_NUM;
+
 	     if (cfdata->locals.add)
 	       {
 		  found = 0;
@@ -1305,7 +1307,7 @@
 	if (b[0]) strcat(b, " + ");
 	strcat(b, _("WIN"));
      }
-
+
    if (bi->key && bi->key[0])
      {
 	char *l;
@@ -1317,6 +1319,12 @@
 	free(l);
      }

+   if (bi->modifiers & ECORE_X_LOCK_NUM)
+     {
+	if (b[0]) strcat(b, " ");
+	strcat(b, _("OFF"));
+     }
+
    if (!b[0]) return strdup(TEXT_NONE_ACTION_KEY);
    return strdup(b);
 }


Golay code is never included on non AES boards

--- Firmware/radio/radio.h
+++ Firmware/radio/radio.h
@@ -35,6 +35,10 @@
 #ifndef _RADIO_H_
 #define _RADIO_H_

+#ifndef INCLUDE_AES
+#define INCLUDE_GOLAY
+#endif
+
 /// @page hardware Notes on Hardware Allocation
 ///
 /// @section timers Timer Allocation


Simplify function call generate (part 1)

This gets rid of the ia32 and arm variants of generateFunctionCall
(they'll have to be re-done anyway) and replaces the duplicated
bodies of the generateFunctionCallImp overloads with calls to
one single instance that has the maximum number of supported arguments.

The recently introduce VoidType takes care of non-existant arguments.

Change-Id: I7c41f58a72840837709e65620d7f384e4b18f2a8
Reviewed-by: Lars Knoll <a812617a4072dcbeb80684eca0f369f0083af109@digia.com>

--- qv4isel_masm_p.h
+++ qv4isel_masm_p.h
@@ -280,6 +280,11 @@
             move(imm32, dest);
     }

+    void loadArgument(VoidType, RegisterID)
+    {
+        // Nothing to do.
+    }
+
     void storeArgument(RegisterID src, IR::Temp *temp)
     {
         if (temp) {
@@ -352,91 +357,6 @@

     #define generateFunctionCall(t, function, ...) \
         generateFunctionCallImp(t, isel_stringIfy(function), function, __VA_ARGS__)
-
-#if CPU(X86)
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
-    {
-        callFunctionPrologue();
-        // Reverse order
-        push(arg6);
-        push(arg5);
-        push(arg4);
-        push(arg3);
-        push(arg2);
-        push(arg1);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(6 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
-    {
-        callFunctionPrologue();
-        // Reverse order
-        push(arg5);
-        push(arg4);
-        push(arg3);
-        push(arg2);
-        push(arg1);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(5 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-
-
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
-    {
-        callFunctionPrologue();
-        // Reverse order
-        push(arg4);
-        push(arg3);
-        push(arg2);
-        push(arg1);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(4 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-
-
-    template <typename Arg1, typename Arg2, typename Arg3>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3)
-    {
-        callFunctionPrologue();
-        // Reverse order
-        push(arg3);
-        push(arg2);
-        push(arg1);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(3 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-
-    template <typename Arg1, typename Arg2>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2)
-    {
-        callFunctionPrologue();
-        // Reverse order
-        push(arg2);
-        push(arg1);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(2 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-#elif CPU(X86_64)
-    template <typename ArgRet, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-    void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        loadArgument(arg4, RegisterArgument4);
-        callAbsolute(functionName, function);
-        storeArgument(ReturnValueRegister, r);
-        callFunctionEpilogue();
-    }

     template <typename ArgRet, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
     void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
@@ -452,105 +372,29 @@
         callFunctionEpilogue();
     }

+    template <typename ArgRet, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+    void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+    {
+        generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, arg4, VoidType());
+    }
+
     template <typename ArgRet, typename Arg1, typename Arg2, typename Arg3>
     void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3)
     {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        callAbsolute(functionName, function);
-        storeArgument(ReturnValueRegister, r);
-        callFunctionEpilogue();
+        generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, VoidType(), VoidType());
     }

     template <typename ArgRet, typename Arg1, typename Arg2>
     void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2)
     {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        callAbsolute(functionName, function);
-        storeArgument(ReturnValueRegister, r);
-        callFunctionEpilogue();
+        generateFunctionCallImp(r, functionName, function, arg1, arg2, VoidType(), VoidType(), VoidType());
     }

     template <typename ArgRet, typename Arg1>
     void generateFunctionCallImp(ArgRet r, const char* functionName, FunctionPtr function, Arg1 arg1)
     {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        callAbsolute(functionName, function);
-        storeArgument(ReturnValueRegister, r);
-        callFunctionEpilogue();
-    }
-
-#elif CPU(ARM)
-
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        loadArgument(arg4, RegisterArgument4);
-        push(arg5);
-        push(arg6);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(2 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        loadArgument(arg4, RegisterArgument4);
-        push(arg5);
-        callAbsolute(functionName, function);
-        add32(TrustedImm32(1 * sizeof(void*)), StackPointerRegister);
-        callFunctionEpilogue();
-    }
-
-
-    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        loadArgument(arg4, RegisterArgument4);
-        callAbsolute(functionName, function);
-        callFunctionEpilogue();
-    }
-
-
-    template <typename Arg1, typename Arg2, typename Arg3>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        loadArgument(arg3, RegisterArgument3);
-        callAbsolute(functionName, function);
-        callFunctionEpilogue();
-    }
-
-    template <typename Arg1, typename Arg2>
-    void generateFunctionCallImp(const char* functionName, FunctionPtr function, Arg1 arg1, Arg2 arg2)
-    {
-        callFunctionPrologue();
-        loadArgument(arg1, RegisterArgument1);
-        loadArgument(arg2, RegisterArgument2);
-        callAbsolute(functionName, function);
-        callFunctionEpilogue();
-    }
-
-#endif
+        generateFunctionCallImp(r, functionName, function, arg1, VoidType(), VoidType(), VoidType(), VoidType());
+    }

     int prepareVariableArguments(IR::ExprList* args);


Pack threadset_t a little tighter.

Pack threadset_t a little tighter.

--- re2jit/threads.h
+++ re2jit/threads.h
@@ -79,12 +79,12 @@
     {
         const char *input;
         size_t length;
+        // Entry point of the initial thread -- the one which is spawned
+        // at the beginning of the input.
+        void *entry;
         // Length of `groups` in each thread. NOT the number of groups in the regex.
         // More like double that. That is, +1 for each open and closing parenthesis.
         int ngroups;
-        // Entry point of the initial thread -- the one which is spawned
-        // at the beginning of the input.
-        void *entry;
         // Options such as anchoring of the regex.
         int flags;
         // Ring buffer of thread queues. The threads in the active queue are run,