proxy_read_resolv(): early return

proxy_read_resolv(): early return

--- src/ext-dns.c
+++ src/ext-dns.c
@@ -563,38 +563,39 @@
 {
 	static time_t last_checked = 0;
 	static time_t last_modified = 0;
+	last_checked = gconf->time_now;
+	// Check at most every second
+	if (last_checked == gconf->time_now) {
+		return;
+	}
+
 	const char *m = "\nnameserver ";
 	char buf[512] = { 0 };
 	IP addr;
 	struct stat attr;
 	FILE *file;

-	// Check at most every second
-	if (last_checked != gconf->time_now) {
-		last_checked = gconf->time_now;
-
-		// Check if path was modified
-		stat(path, &attr);
-		if (last_modified != attr.st_mtime) {
-			last_modified = attr.st_mtime;
-
-			file = fopen(path, "rb");
-			if (file) {
-				fread(buf, sizeof(buf) - 1, 1, file);
-				fclose(file);
-				const char *beg = strstr(buf, m);
-				if (beg == NULL) {
-					// Ignore missing address
-				} else if (addr_parse(&addr, beg + strlen(m), "53", AF_UNSPEC) < 0) {
-					log_warning("DNS: Failed to read DNS server from %s", path);
-				} else if (addr_is_localhost(&addr)) {
-					// Ignore localhost entries
-				} else {
-					*dst = addr;
-				}
+	// Check if path was modified
+	stat(path, &attr);
+	if (last_modified != attr.st_mtime) {
+		last_modified = attr.st_mtime;
+
+		file = fopen(path, "rb");
+		if (file) {
+			fread(buf, sizeof(buf) - 1, 1, file);
+			fclose(file);
+			const char *beg = strstr(buf, m);
+			if (beg == NULL) {
+				// Ignore missing address
+			} else if (addr_parse(&addr, beg + strlen(m), "53", AF_UNSPEC) < 0) {
+				log_warning("DNS: Failed to read DNS server from %s", path);
+			} else if (addr_is_localhost(&addr)) {
+				// Ignore localhost entries
 			} else {
-				log_warning("DNS: Failed to open %s", path);
-			}
+				*dst = addr;
+			}
+		} else {
+			log_warning("DNS: Failed to open %s", path);
 		}
 	}
 }


clean up warnings

clean up warnings

--- libc/sysdeps/linux/common/noophooks.c
+++ libc/sysdeps/linux/common/noophooks.c
@@ -18,9 +18,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

-#include <features.h>
+#include <libc-internal.h>

-void __cyg_profile_func_enter (void *this_fn, void *call_site)
+void
+__cyg_profile_func_enter (attribute_unused void *this_fn, attribute_unused void *call_site)
 {
 }
 strong_alias (__cyg_profile_func_enter, __cyg_profile_func_exit)


Fix static sized arrays.

Fix static sized arrays.

--- src/fastcsv.c
+++ src/fastcsv.c
@@ -73,7 +73,7 @@
     pthread_barrier_t barrier1;
     pthread_barrier_t barrier2;
     int flags;
-    int str_idxs[256];
+    int *str_idxs;
     int n_str_cols;
     FastCsvResult *result;
     uchar sep;
@@ -388,6 +388,8 @@
         nrows += chunks[i].nrows;
     }

+    common->str_idxs = (int *)malloc(ncols * sizeof(int));
+
     for (col_idx = 0; col_idx < ncols; col_idx++) {
         uchar *xs;
         int col_type;
@@ -710,8 +712,8 @@
     LinkedLink *offset_link;
     uchar *offset_ptr;
     const uchar *rowp;
-    LinkedLink *val_links[256];
-    uchar *val_ptrs[256];
+    LinkedLink **val_links;
+    uchar **val_ptrs;
     int col_idx;
     int first_row;
     int i;
@@ -742,6 +744,8 @@
     offset_ptr = offset_link->data;
     rowp = bigchunk->buf;

+    val_links = (LinkedLink **)malloc(bigchunk->ncols * sizeof(LinkedLink *));
+    val_ptrs = (uchar **)malloc(bigchunk->ncols * sizeof(uchar *));
     for (col_idx = 0; col_idx < bigchunk->ncols; col_idx++) {
         val_links[col_idx] = CHUNK_COLUMN(bigchunk, col_idx).buf.first;
         val_ptrs[col_idx] = CHUNK_COLUMN(bigchunk, col_idx).buf.first_data;
@@ -822,6 +826,9 @@
         chunk->ncols = ncols;
         first_row += nrows;
     }
+
+    free(val_links);
+    free(val_ptrs);

     return 0;
 }
@@ -963,6 +970,7 @@
     common.nchunks = nthreads;
     common.all_chunks = chunks;
     common.bigchunk = NULL;
+    common.str_idxs = NULL;
     common.n_str_cols = 0;
     common.flags = input->flags;
     common.sep = input->sep;
@@ -1015,6 +1023,7 @@
         free(common.bigchunk);
     }
     free(chunks);
+    free(common.str_idxs);

     return 0;
 }


usb_prl_sm: Fix spelling

usb_prl_sm: Fix spelling

wad -> was

BUG=none
TEST=make buildall
BRANCH=none

Signed-off-by: Abe Levkoy <2e1ad7039298f93262cf06bbb457275fb3e2ecb5@chromium.org>
Change-Id: I75647696c7150b03d681e190d803fd5de28523d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2812140
Reviewed-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>

--- common/usbc/usb_prl_sm.c
+++ common/usbc/usb_prl_sm.c
@@ -1712,7 +1712,7 @@
 			 */
 			else {
 				/*
-				 * No error wad detected, so clear
+				 * No error was detected, so clear
 				 * PRL_FLAGS_MSG_RECEIVED flag.
 				 */
 				RCH_CLR_FLAG(port, PRL_FLAGS_MSG_RECEIVED);


fix build

fix build

--- src/sdk/module/default/simple_security_manager.h
+++ src/sdk/module/default/simple_security_manager.h
@@ -20,10 +20,10 @@

 class AsyncSimpleSecurityManager : public SecurityManager {
  protected:
-  std::unique_ptr<boost::asio::strand> _strand;
+  std::unique_ptr<boost::asio::io_service::strand> _strand;

  public:
-  explicit AsyncSimpleSecurityManager(boost::asio::strand* strand);
+  explicit AsyncSimpleSecurityManager(boost::asio::io_service::strand* strand);

   void get_client(const std::string& dsid, const std::string& auth_token,
                   GetClientCallback&& callback) override;


Change log file format

Change log file format

--- src/file_io.c
+++ src/file_io.c
@@ -38,13 +38,14 @@
     while(1)
     {
         if(attempt == 1)
-            snprintf(filename, filename_size, "%s%s_%02u%02u%02u.%s",
+            snprintf(filename, filename_size, "%s%s_%02u%02u%02u%02u%02u.%s",
                 in_data_folder ? data_folder() : "", prefix, tm.tm_year % 100,
-                tm.tm_mon, tm.tm_mday, extension);
+                tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, extension);
         else
-            snprintf(filename, filename_size, "%s%s_%02u%02u%02u_%u.%s",
+            snprintf(filename, filename_size, "%s%s_%02u%02u%02u%02u%02u_%u.%s",
                 in_data_folder ? data_folder() : "", prefix, tm.tm_year % 100,
-                tm.tm_mon, tm.tm_mday, attempt, extension);
+                tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, attempt,
+                extension);

         int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
         /* File created */


Fixed asm=1 build

Fixed asm=1 build

--- src/fin_mod.c
+++ src/fin_mod.c
@@ -415,25 +415,25 @@
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch_if_n);
             uint8_t* lbl_else = cmp->code.top;
             fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
-            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_else - cmp->code_begin));
+            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_else - cmp->code.begin));
             fin_mod_compile_expr(ctx, cmp, cond_expr->true_expr);
             if (cond_expr->false_expr) {
                 fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch);
                 uint8_t* lbl_end = cmp->code.top;
                 fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
-                FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_end - cmp->code_begin));
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code_begin));
+                FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_end - cmp->code.begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code.begin));
                 uint16_t offset = cmp->code.top - lbl_else - 2;
                 *lbl_else++ = offset & 0xFF;
                 *lbl_else++ = (offset >> 8) & 0xFF;
                 fin_mod_compile_expr(ctx, cmp, cond_expr->false_expr);
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code_begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code.begin));
                 offset = cmp->code.top - lbl_end - 2;
                 *lbl_end++ = offset & 0xFF;
                 *lbl_end++ = (offset >> 8) & 0xFF;
             }
             else {
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code_begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code.begin));
                 uint16_t offset = cmp->code.top - lbl_else - 2;
                 *lbl_else++ = offset & 0xFF;
                 *lbl_else++ = (offset >> 8) & 0xFF;
@@ -540,25 +540,25 @@
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch_if_n);
             uint8_t* lbl_else = cmp->code.top;
             fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
-            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_else - cmp->code_begin));
+            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_else - cmp->code.begin));
             fin_mod_compile_stmt(ctx, cmp, if_stmt->true_stmt);
             if (if_stmt->false_stmt) {
                 fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch);
                 uint8_t* lbl_end = cmp->code.top;
                 fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
-                FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_end - cmp->code_begin));
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code_begin));
+                FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_end - cmp->code.begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code.begin));
                 uint16_t offset = cmp->code.top - lbl_else - 2;
                 *lbl_else++ = offset & 0xFF;
                 *lbl_else++ = (offset >> 8) & 0xFF;
                 fin_mod_compile_stmt(ctx, cmp, if_stmt->false_stmt);
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code_begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code.begin));
                 offset = cmp->code.top - lbl_end - 2;
                 *lbl_end++ = offset & 0xFF;
                 *lbl_end++ = (offset >> 8) & 0xFF;
             }
             else {
-                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code_begin));
+                FIN_LOG("lbl_%d:\n", (int32_t)(lbl_else - cmp->code.begin));
                 uint16_t offset = cmp->code.top - lbl_else - 2;
                 *lbl_else++ = offset & 0xFF;
                 *lbl_else++ = (offset >> 8) & 0xFF;
@@ -568,18 +568,18 @@
         case fin_ast_stmt_type_while: {
             fin_ast_while_stmt* while_stmt = (fin_ast_while_stmt*)stmt;
             uint8_t* lbl_loop = cmp->code.top;
-            FIN_LOG("lbl_%d:\n", (int32_t)(lbl_loop - cmp->code_begin));
+            FIN_LOG("lbl_%d:\n", (int32_t)(lbl_loop - cmp->code.begin));
             fin_mod_compile_expr(ctx, cmp, while_stmt->cond);
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch_if_n);
             uint8_t* lbl_end = cmp->code.top;
             fin_mod_code_emit_uint16(ctx, &cmp->code, 0);
-            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_end - cmp->code_begin));
+            FIN_LOG("\tbr_if_n     lbl_%d\n", (int32_t)(lbl_end - cmp->code.begin));
             fin_mod_compile_stmt(ctx, cmp, while_stmt->stmt);
             uint16_t offset = lbl_loop - cmp->code.top - 3;
             fin_mod_code_emit_uint8(ctx, &cmp->code, fin_op_branch);
             fin_mod_code_emit_uint16(ctx, &cmp->code, offset);
-            FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_loop - cmp->code_begin));
-            FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code_begin));
+            FIN_LOG("\tbr          lbl_%d\n", (int32_t)(lbl_loop - cmp->code.begin));
+            FIN_LOG("lbl_%d:\n", (int32_t)(lbl_end - cmp->code.begin));
             offset = cmp->code.top - lbl_end - 2;
             *lbl_end++ = offset & 0xFF;
             *lbl_end++ = (offset >> 8) & 0xFF;


skia/ext: Add SK_API to a function used from a test

BUG=90078
TEST=none

Review URL: http://codereview.chromium.org/9699078

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@127068 0039d316-1c4b-4281-b951-d872f2087c98

--- skia/ext/bitmap_platform_device_mac.h
+++ skia/ext/bitmap_platform_device_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

@@ -26,7 +26,7 @@
 // For us, that other bitmap will become invalid as soon as the device becomes
 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE
 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead.
-class BitmapPlatformDevice : public PlatformDevice, public SkDevice {
+class SK_API BitmapPlatformDevice : public PlatformDevice, public SkDevice {
  public:
   // |context| may be NULL.
   static BitmapPlatformDevice* Create(CGContextRef context,


List/ft_arraytolst don't free the array

List/ft_arraytolst don't free the array


improve PatternBuilder documentation

improve PatternBuilder documentation

--- libhext/include/hext/PatternBuilder.h
+++ libhext/include/hext/PatternBuilder.h
@@ -32,7 +32,7 @@
 namespace hext {

-/// When parsing hext rule definitions, a PatternBuilder is responsible for
+/// When parsing hext rule definitions, PatternBuilder is responsible for
 /// creating MatchPatterns and CapturePatterns.
 class PatternBuilder
 {
@@ -58,14 +58,31 @@
   /// Consume a ChildCountMatch.
   void consume_child_count(const std::string& child_count);

+  /// Set builtin function. Return false if builtin cannot be found.
   bool set_builtin(const std::string& bi);
+
+  /// Set attribute name of the Pattern.
   void set_attr_name(const std::string& attribute_name);
+
+  /// Set literal attribute value of the Pattern.
   void set_attr_literal(const std::string& attribute_literal);
+
+  /// Set regex attribute value of the Pattern.
   void set_attr_regex(const std::string& attribute_regex);
+
+  /// Set the CapturePattern's result name.
   void set_cap_var(const std::string& capture_var);
+
+  /// Set the CapturePattern's regex.
   void set_cap_regex(const std::string& capture_regex);
+
+  /// Set the NthChildMatch's multiplier.
   void set_nth_mul(const std::string& multiplier);
+
+  /// Set the NthChildMatch's addend.
   void set_nth_add(const std::string& addend);
+
+  /// Set literal operator-
   void set_literal_op(char op);

 private:
@@ -78,16 +95,37 @@
   /// Append a CapturePattern.
   void consume_capture_pattern();

+  /// The current builtin function.
   BuiltinFuncPtr bf_;
+
+  /// The current attribute name.
   std::string attr_name_;
+
+  /// The current attribute literal value.
   std::string attr_literal_;
+
+  /// The current attribute regex value.
   boost::regex attr_regex_;
+
+  /// The current CapturePattern's result name.
   std::string cap_var_;
+
+  /// The current CapturePattern's optional regex.
   boost::optional<boost::regex> cap_regex_;
+
+  /// The current NthChildMatch's multiplier.
   int nth_multiplier_;
+
+  /// The current NthChildMatch's addend.
   int nth_addend_;
+
+  /// The current literal operator.
   char literal_operator_;
+
+  /// Consumed MatchPatterns.
   std::vector<std::unique_ptr<MatchPattern>> mp_;
+
+  /// Consumed CapturePatterns.
   std::vector<std::unique_ptr<CapturePattern>> cp_;
 };


(fontset_table): New variable. (free_fontset): Call M17N_OBJECT_UNREGISTER. (mfont__fontset_init): Add fontset_table as an object array. (mfont__realize_fontset): Ref FONTSET. (mfont__free_realized_fontset): Unref REALIZED->fontset. (mfontset): Call M17N_OBJECT_REGISTER. (mfontset_copy): Likewise.

--- src/fontset.c
+++ src/fontset.c
@@ -73,6 +73,8 @@
 #include "internal-gui.h"
 #include "font.h"
 #include "fontset.h"
+
+static M17NObjectArray fontset_table;

 struct MFontset
 {
@@ -287,6 +289,7 @@
       M17N_OBJECT_UNREF (fontset_list);
       fontset_list = NULL;
     }
+  M17N_OBJECT_UNREGISTER (fontset_table, fontset);
   free (object);
 }

@@ -463,6 +466,8 @@
 int
 mfont__fontset_init ()
 {
+  M17N_OBJECT_ADD_ARRAY (fontset_table, "Fontset");
+
   Mfontset = msymbol ("fontset");
   Mfontset->managing_key = 1;
   fontset_list = mplist ();
@@ -522,6 +527,7 @@

   MSTRUCT_CALLOC (realized, MERROR_FONTSET);
   realized->fontset = fontset;
+  M17N_OBJECT_REF (fontset);
   realized->tick = fontset->tick;
   if (spec)
     {
@@ -540,6 +546,7 @@
 mfont__free_realized_fontset (MRealizedFontset *realized)
 {
   free_realized_fontset_elements (realized);
+  M17N_OBJECT_UNREF (realized->fontset);
   if (realized->spec)
     free (realized->spec);
   free (realized);
@@ -908,6 +915,7 @@
       else
 	{
 	  M17N_OBJECT (fontset, free_fontset, MERROR_FONTSET);
+	  M17N_OBJECT_REGISTER (fontset_table, fontset);
 	  fontset->name = sym;
 	  fontset->mdb = mdatabase_find (Mfontset, sym, Mnil, Mnil);
 	  if (! fontset->mdb)
@@ -965,6 +973,7 @@
   if (copy)
     return NULL;
   M17N_OBJECT (copy, free_fontset, MERROR_FONTSET);
+  M17N_OBJECT_REGISTER (fontset_table, copy);
   copy->name = sym;

   if (fontset->mdb)


Wait for device reboot when using fwupdtool detach

--- src/fu-tool.c
+++ src/fu-tool.c
@@ -26,6 +26,7 @@
 #include "fu-cabinet.h"
 #include "fu-context-private.h"
 #include "fu-debug.h"
+#include "fu-device-list.h"
 #include "fu-device-private.h"
 #include "fu-engine.h"
 #include "fu-history.h"
@@ -1521,6 +1522,7 @@
 fu_util_detach(FuUtilPrivate *priv, gchar **values, GError **error)
 {
 	g_autoptr(FuDevice) device = NULL;
+	g_autoptr(FuDeviceList) device_list = fu_device_list_new();
 	g_autoptr(FuDeviceLocker) locker = NULL;

 	/* load engine */
@@ -1545,7 +1547,18 @@
 	locker = fu_device_locker_new(device, error);
 	if (locker == NULL)
 		return FALSE;
-	return fu_device_detach_full(device, priv->progress, error);
+	fu_device_list_add(device_list, device);
+	if (!fu_device_detach_full(device, priv->progress, error))
+		return FALSE;
+
+	/* wait for replug */
+	if (!priv->no_safety_check) {
+		if (!fu_device_list_wait_for_replug(device_list, error))
+			return FALSE;
+	}
+
+	/* success */
+	return TRUE;
 }

 static gboolean
@@ -1618,6 +1631,7 @@
 fu_util_attach(FuUtilPrivate *priv, gchar **values, GError **error)
 {
 	g_autoptr(FuDevice) device = NULL;
+	g_autoptr(FuDeviceList) device_list = fu_device_list_new();
 	g_autoptr(FuDeviceLocker) locker = NULL;

 	/* load engine */
@@ -1642,7 +1656,18 @@
 	locker = fu_device_locker_new(device, error);
 	if (locker == NULL)
 		return FALSE;
-	return fu_device_attach_full(device, priv->progress, error);
+	fu_device_list_add(device_list, device);
+	if (!fu_device_attach_full(device, priv->progress, error))
+		return FALSE;
+
+	/* wait for replug */
+	if (!priv->no_safety_check) {
+		if (!fu_device_list_wait_for_replug(device_list, error))
+			return FALSE;
+	}
+
+	/* success */
+	return TRUE;
 }

 static gboolean


Added DEBUG_SDL_RECT

Added DEBUG_SDL_RECT

--- src/gamelib.h
+++ src/gamelib.h
@@ -60,10 +60,10 @@
 #define DEBUG_SDL_CURSOR
 //#define DEBUG_SDL_CURSOR_OBJ

-//#define DEBUG_DRAWABLE
+#define DEBUG_DRAWABLE
 //#define DEBUG_DRAWABLE_OBJ

-//#define DEBUG_SDL_DRAWABLE
+#define DEBUG_SDL_DRAWABLE
 //#define DEBUG_SDL_DRAWABLE_OBJ

 #define DEBUG_SDL_PIXEL
@@ -71,6 +71,10 @@

 #define DEBUG_SDL_LINE
 //#define DEBUG_SDL_LINE_OBJ
+
+#define DEBUG_SDL_RECT
+//#define DEBUG_SDL_RECT_OBJ
+
 #define DEBUG_FONT
 #define DEBUG_FONT_OBJ


GBA: Fix patching being incompatible with GBAUnloadROM

--- src/gba/gba.c
+++ src/gba/gba.c
@@ -435,10 +435,10 @@

 void GBAApplyPatch(struct GBA* gba, struct Patch* patch) {
 	size_t patchedSize = patch->outputSize(patch, gba->memory.romSize);
-	if (!patchedSize) {
-		return;
-	}
-	gba->memory.rom = anonymousMemoryMap(patchedSize);
+	if (!patchedSize || patchedSize > SIZE_CART0) {
+		return;
+	}
+	gba->memory.rom = anonymousMemoryMap(SIZE_CART0);
 	if (!patch->applyPatch(patch, gba->pristineRom, gba->pristineRomSize, gba->memory.rom, patchedSize)) {
 		mappedMemoryFree(gba->memory.rom, patchedSize);
 		gba->memory.rom = gba->pristineRom;


Add missing GBA_KEY_NONE

Add missing GBA_KEY_NONE

--- src/gba/gba.h
+++ src/gba/gba.h
@@ -55,7 +55,8 @@
 	GBA_KEY_UP = 6,
 	GBA_KEY_DOWN = 7,
 	GBA_KEY_R = 8,
-	GBA_KEY_L = 9
+	GBA_KEY_L = 9,
+	GBA_KEY_NONE = -1
 };

 struct GBARotationSource;


don't set heading filter when subscription is active

--- src/getback.c
+++ src/getback.c
@@ -491,8 +491,8 @@
   Tuple *sens_tuple = dict_find(iter, SENS_KEY);
   if (sens_tuple) {
     sensitivity = sens_tuple->value->int8;
+    compass_service_unsubscribe();
     compass_service_set_heading_filter(TRIG_MAX_ANGLE*sensitivity/360);
-    compass_service_unsubscribe();
     compass_service_subscribe(&compass_heading_handler);
     APP_LOG(APP_LOG_LEVEL_DEBUG, "Sensitivity: %d", sensitivity);
   }


Use a gettext.h file with a matching license

Since we want our project to be licensed under LGPLv2+, we cannot have a
LGPLv3-licensed source file in the tree. Let's thus use the gnulib's gettext.h
licensed under LGPLv2+.

--- src/gettext.h
+++ src/gettext.h
@@ -1,18 +1,19 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
+   Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */

 #ifndef _LIBGETTEXT_H
 #define _LIBGETTEXT_H 1


ba_walk_local: forgot call to ba_walk

ba_walk_local: forgot call to ba_walk

--- src/gjalloc.c
+++ src/gjalloc.c
@@ -787,7 +787,8 @@
     return n;
 }

-EXPORT INLINE void ba_local_grow(struct ba_local * a, uint32_t blocks) {
+EXPORT INLINE void ba_local_grow(struct ba_local * a,
+				 const uint32_t blocks) {
     struct ba_layout l;
     int transform = 0;

@@ -925,7 +926,7 @@
     if (!a->a) {
 	if (a->page)
 	    ba_walk_page(&a->l, a->page, callback, data);
-    }
+    } else ba_walk(a->a, callback, data);
     if (a->page)
 	a->h = a->page->h;
 }


glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor.

--- src/glsl/ir_variable_refcount.h
+++ src/glsl/ir_variable_refcount.h
@@ -78,8 +78,6 @@

    variable_entry *get_variable_entry(ir_variable *var);

-   bool (*predicate)(ir_instruction *ir);
-
    /* List of variable_entry */
    exec_list variable_list;


Tegra: Fix the delay loop used during SC7 exit

This patch fixes the delay loop used to wake up the BPMP during SC7 exit.
The earlier loop would fail just when the timer was about to wrap-around
(e.g. when TEGRA_TMRUS_BASE is 0xfffffffe, the target value becomes 0,
which would cause the loop to exit before it's expiry).

Signed-off-by: Varun Wadekar <517ae08f01cae398dbba5bef5ba1750f384c6daf@nvidia.com>

--- plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c
+++ plat/nvidia/tegra/common/drivers/flowctrl/flowctrl.c
@@ -31,6 +31,7 @@
 #include <arch_helpers.h>
 #include <assert.h>
 #include <debug.h>
+#include <delay_timer.h>
 #include <mmio.h>
 #include <pmc.h>
 #include <cortex_a53.h>
@@ -230,10 +231,7 @@
 		; /* wait till value reaches EVP_BPMP_RESET_VECTOR */

 	/* Wait for 2us before de-asserting the reset signal. */
-	val = mmio_read_32(TEGRA_TMRUS_BASE);
-	val += 2;
-	while (val > mmio_read_32(TEGRA_TMRUS_BASE))
-		; /* wait for 2us */
+	udelay(2);

 	/* De-assert BPMP reset */
 	mmio_write_32(TEGRA_CAR_RESET_BASE + CLK_RST_DEV_L_CLR, CLK_BPMP_RST);


Fix progress logging when scale factor is large.

Integer overflow showed minus percent and minus remaining time something like this.
  239300000 of 3800000000 tuples (-48%) done (elapsed 226.86 s, remaining -696.10 s).

--- contrib/pgbench/pgbench.c
+++ contrib/pgbench/pgbench.c
@@ -1720,11 +1720,11 @@
 			INSTR_TIME_SUBTRACT(diff, start);

 			elapsed_sec = INSTR_TIME_GET_DOUBLE(diff);
-			remaining_sec = (scale * naccounts - j) * elapsed_sec / j;
+			remaining_sec = ((double) scale * naccounts - j) * elapsed_sec / j;

 			fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s).\n",
 					j, (int64) naccounts * scale,
-					(int) (((int64) j * 100) / (naccounts * scale)),
+					(int) (((int64) j * 100) / (naccounts * (int64) scale)),
 					elapsed_sec, remaining_sec);
 		}
 		/* let's not call the timing for each row, but only each 100 rows */
@@ -1734,14 +1734,14 @@
 			INSTR_TIME_SUBTRACT(diff, start);

 			elapsed_sec = INSTR_TIME_GET_DOUBLE(diff);
-			remaining_sec = (scale * naccounts - j) * elapsed_sec / j;
+			remaining_sec = ((double) scale * naccounts - j) * elapsed_sec / j;

 			/* have we reached the next interval (or end)? */
 			if ((j == scale * naccounts) || (elapsed_sec >= log_interval * LOG_STEP_SECONDS))
 			{
 				fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s).\n",
 						j, (int64) naccounts * scale,
-						(int) (((int64) j * 100) / (naccounts * scale)), elapsed_sec, remaining_sec);
+						(int) (((int64) j * 100) / (naccounts * (int64) scale)), elapsed_sec, remaining_sec);

 				/* skip to the next interval */
 				log_interval = (int) ceil(elapsed_sec / LOG_STEP_SECONDS);


Btrfs: re-add root to dead root list if we stop dropping it

If we stop dropping a root for whatever reason we need to add it back to the
dead root list so that we will re-start the dropping next transaction commit.
The other case this happens is if we recover a drop because we will add a root
without adding it to the fs radix tree, so we can leak it's root and commit root
extent buffer, adding this to the dead root list makes this cleanup happen.
Thanks,

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Reported-by: Alex Lyakas <677ca0f49c3bd0785f7c25b8a07d89e0c6113e08@zadarastorage.com>
Signed-off-by: Josef Bacik <631dfb3d07694fdcf26abc7aac2c6c2b641f8bde@fusionio.com>

--- fs/btrfs/extent-tree.c
+++ fs/btrfs/extent-tree.c
@@ -7466,6 +7466,7 @@
 	int err = 0;
 	int ret;
 	int level;
+	bool root_dropped = false;

 	path = btrfs_alloc_path();
 	if (!path) {
@@ -7643,12 +7644,22 @@
 		free_extent_buffer(root->commit_root);
 		btrfs_put_fs_root(root);
 	}
+	root_dropped = true;
 out_end_trans:
 	btrfs_end_transaction_throttle(trans, tree_root);
 out_free:
 	kfree(wc);
 	btrfs_free_path(path);
 out:
+	/*
+	 * So if we need to stop dropping the snapshot for whatever reason we
+	 * need to make sure to add it back to the dead root list so that we
+	 * keep trying to do the work later.  This also cleans up roots if we
+	 * don't have it in the radix (like when we recover after a power fail
+	 * or unmount) so we don't leak memory.
+	 */
+	if (root_dropped == false)
+		btrfs_add_dead_root(root);
 	if (err)
 		btrfs_std_error(root->fs_info, err);
 	return err;


tests: Fix leak in appmonitor test

tests: Fix leak in appmonitor test

Spotted by Daniel Macks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260

--- gio/tests/appmonitor.c
+++ gio/tests/appmonitor.c
@@ -97,11 +97,12 @@
 int
 main (int argc, char *argv[])
 {
-  gchar *path;
+  gchar *path = NULL;

   path = g_mkdtemp (g_strdup ("app_monitor_XXXXXX"));
   g_setenv ("XDG_DATA_DIRS", path, TRUE);
   g_setenv ("XDG_DATA_HOME", path, TRUE);
+  g_free (path);

   g_test_init (&argc, &argv, NULL);


test with default and a private callback

--- test/genericLoggerTester.c
+++ test/genericLoggerTester.c
@@ -1,14 +1,57 @@
 #include "genericLogger.h"

+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+static void localLogger(void *userDatavp, genericLoggerLevel_t logLeveli, const char *msgs);
+typedef struct localStruct {
+  int i;
+} localStruct_t;

 int main() {
-  genericLogger_t *loggerp = genericLogger_newp(NULL, NULL, GENERICLOGGER_LOGLEVEL_TRACE);
+  genericLogger_t *loggerp;
+  localStruct_t    localStruct;

-  GENERICLOGGER_TRACE (loggerp, "Single message");
-  GENERICLOGGER_TRACEF(loggerp, "%s %s", "Formatted", "Message");
+  /* With no logger allocated - it still work - and defaults to the WARN level */
+  GENERICLOGGER_WARN (NULL, "Single message");
+  GENERICLOGGER_WARNF(NULL, "%s %s", "Formatted", "Message");

-  genericLogger_freev(&loggerp);
+  /* With a custom logger */
+  loggerp = genericLogger_newp(NULL, NULL, GENERICLOGGER_LOGLEVEL_TRACE);
+  if (loggerp != NULL) {
+    GENERICLOGGER_TRACE (loggerp, "Single message");
+    GENERICLOGGER_TRACEF(loggerp, "%s %s", "Formatted", "Message");
+    genericLogger_freev(&loggerp);
+  } else {
+    fprintf(stderr, "Failure to allocate a logger, %s\n", strerror(errno));
+  }
+
+  /* With a callback */
+  loggerp = genericLogger_newp(localLogger, &localStruct, GENERICLOGGER_LOGLEVEL_TRACE);
+  if (loggerp != NULL) {
+    localStruct.i = 10;
+    GENERICLOGGER_TRACE (loggerp, "Single message");
+    GENERICLOGGER_TRACEF(loggerp, "%s %s", "Formatted", "Message");
+    genericLogger_freev(&loggerp);
+  } else {
+    fprintf(stderr, "Failure to allocate a logger, %s\n", strerror(errno));
+  }

   return 0;
 }
+
+static void localLogger(void *userDatavp, genericLoggerLevel_t logLeveli, const char *msgs) {
+  localStruct_t *localStructp = (localStruct_t *) userDatavp;
+
+  fprintf(stderr, "I am the local logger, localStruct.i = %d, msgs = %s\n", localStructp->i, msgs);
+}


Support usage of C API with C++ standards older than C++11 (#4257)

* Use throw() in C API if noexcept is not supported

--- include/onnxruntime/core/session/onnxruntime_c_api.h
+++ include/onnxruntime/core/session/onnxruntime_c_api.h
@@ -69,11 +69,21 @@

 // Any pointer marked with _In_ or _Out_, cannot be NULL.

-#ifdef __cplusplus
 // Windows users should use unicode paths when possible to bypass the MAX_PATH limitation
 // Every pointer marked with _In_ or _Out_, cannot be NULL. Caller should ensure that.
 // for ReleaseXXX(...) functions, they can accept NULL pointer.
+
+#ifdef __cplusplus
+// For any compiler with C++11 support, MSVC 2015 and greater, or Clang version supporting noexcept.
+// Such complex condition is needed because compilers set __cplusplus value differently.
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1900) || (defined(__has_feature) && __has_feature(cxx_noexcept)))
 #define NO_EXCEPTION noexcept
+#else
+#define NO_EXCEPTION throw()
+#endif
 #else
 #define NO_EXCEPTION
 #endif


streamlined more.  no button.

streamlined more.  no button.

--- fancyTimers/fancyTimers.c
+++ fancyTimers/fancyTimers.c
@@ -33,7 +33,6 @@
   // -------- Inits --------- //
   initTimerTicks();
   LED_DDR = 0xff;		/* all output */
-  set_bit(BUTTON_PORT, BUTTON);	/* enable pullup on button */

   // ------ Event loop ------ //
   while(1){
@@ -46,14 +45,6 @@
       }
     }

-    /* Reset and resync with button press */
-    if (bit_is_clear(BUTTON_IN, BUTTON)){
-      for (i=0 ; i<8 ; i++){	/* resync */
-	ledTime[i] = 0;
-      }
-      LED_PORT = 0; 		/* reset */
-    }
-
   }    /* End event loop */
   return(0);		      /* This line is never reached  */
 }


ocfs2_dlmfs: Fix math error when reading LVB.

When asked for a partial read of the LVB in a dlmfs file, we can
accidentally calculate a negative count.

Reported-by: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Joel Becker <823d0e2e55da83c1616b20ae9a15f9456fa076e5@oracle.com>

--- fs/ocfs2/dlmfs/dlmfs.c
+++ fs/ocfs2/dlmfs/dlmfs.c
@@ -262,7 +262,7 @@
 	if ((count + *ppos) > i_size_read(inode))
 		readlen = i_size_read(inode) - *ppos;
 	else
-		readlen = count - *ppos;
+		readlen = count;

 	lvb_buf = kmalloc(readlen, GFP_NOFS);
 	if (!lvb_buf)


Revert "-r and --regroup=strategy"

Revert "-r and --regroup=strategy"

This reverts commit 9e4e6deb23e19f18e3bd4e2803859d9b92fc64fa.

--- src/greybox.c
+++ src/greybox.c
@@ -335,9 +335,8 @@
 static pins_loader_t model_loader[MAX_TYPES];
 static int registered=0;
 static int cache=0;
-static int regroup_enable=0;
 static const char regroup_default[] = "cs,cn,rs,rn,cw";
-static const char *regroup_custom = NULL;
+static const char *regroup_options = regroup_default;

 void GBloadFile(model_t model,const char *filename,model_t *wrapped){
 	char* extension=strrchr(filename,'.');
@@ -348,14 +347,12 @@
 				model_loader[i](model,filename);
 				if (wrapped) {
 				  // regroup_options is null if the default should be used
-				  if (regroup_enable) {
-				    if (regroup_custom) Fatal(1,error,"at most one of -r and --regroup allowed");
-				    regroup_custom = regroup_default;
-		          }
-				  if (regroup_custom) {
-				    model = GBregroup(model,regroup_custom);
-				  }
- 				  if (cache) model=GBaddCache(model);
+				  if (regroup_options != regroup_default) {
+                                      const char *spec = regroup_options == NULL ?
+                                          regroup_default : regroup_options;
+				      model = GBregroup(model, spec);
+                                  }
+				  if (cache) model=GBaddCache(model);
 				  *wrapped=model;
 				}
 				return;
@@ -379,9 +376,6 @@

 struct poptOption greybox_options[]={
 	{ "cache" , 'c' , POPT_ARG_VAL , &cache , 1 , "Enable caching of grey box calls." , NULL },
-	{ NULL , 'r' , POPT_ARG_VAL , &regroup_enable , 1 ,
-	    "Regrouping wrapper using defaults" , NULL  },
-	{ "regroup" , 0 , POPT_ARG_STRING , &regroup_custom , 0 ,
-	    "Regrouping wrapper using custom strategy" ,"<{cs,cn,cw,ca,rs,rn,ru},)+>" },
+	{ "regroup" , 'r' , POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &regroup_options , 0 , "Regrouping wrapper, using optional regroup specification" ,"<{cs,cn,cw,ca,rs,rn,ru},)+>" },
 	POPT_TABLEEND
 };


xfs: Add log level to assertion printk

xfs: Add log level to assertion printk

I received a ppc64 bug report involving xfs but the assertion was
filtered out by the console log level. Use KERN_CRIT to ensure it
makes it out.

Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org>
Reviewed-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Alex Elder <f556392d917047d964350b9c68912016c96d5e94@sgi.com>

--- fs/xfs/support/debug.c
+++ fs/xfs/support/debug.c
@@ -104,7 +104,8 @@
 void
 assfail(char *expr, char *file, int line)
 {
-	printk("Assertion failed: %s, file: %s, line: %d\n", expr, file, line);
+	printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr,
+	       file, line);
 	BUG();
 }


setjmp longjmp

setjmp longjmp

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

--- function/set_longjmp.c
+++ function/set_longjmp.c
@@ -0,0 +1,48 @@
+/*File : set_longjmp.c
+ *Auth : sjin
+ *Date : 20141026
+ *Mail : 413977143@qq.com
+ */
+
+/*使用setjmp,longjmp从信号中恢复
+ * */
+#include <stdio.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+
+jmp_buf buf;
+
+void handler(int signal)
+{
+    if(signal == SIGINT){
+        printf("now ,got a SIGINT signal\n");
+    }
+
+    longjmp(buf,1);
+}
+
+int main()
+{
+    int flag = 1;
+    //注册信号回调函数
+    //signal(SIGINT,handler);
+    sigset(SIGINT,handler);
+    if(setjmp(buf)){
+        printf("back in main\n");
+        flag = 0;
+    }else{
+        printf("first time throught\n");
+    }
+
+loop:
+    if(flag == 0){
+        printf("got a signal SIGINT,back in here\n");
+        printf("main exit \n");
+        return 0;
+    }
+    goto loop;
+
+    return 0;
+}
+


Level selection bug fixed

Level selection bug fixed

--- jni/graphics/ui/menu/MainMenu.h
+++ jni/graphics/ui/menu/MainMenu.h
@@ -45,7 +45,7 @@
 				vHandle, tHandle
 		);
 		musicOnOff->setEvents(EVENT_MUSIC_ON, EVENT_MUSIC_OFF);
-		controls.pushHead(musicOnOff);
+		controls.pushTail(musicOnOff);

 	}


Accept terminator as option argument for HYPHENARG

This matches the behavior of GNU Getopt.

Signed-off-by: Kevin Locke <ffb4761cba839470133bee36aeb139f58d7dbaa9@kevinlocke.name>

--- ultragetopt.c
+++ ultragetopt.c
@@ -273,8 +273,8 @@
 			      int allow_option)
 {
     return arg != NULL &&
-	(allow_option || !like_option(arg, optleaders)) &&
-	!like_optterm(arg, optleaders);
+	(allow_option ||
+	    (!like_option(arg, optleaders) && !like_optterm(arg, optleaders)));
 }

 /* If argv[curopt] matches a long option, return the index of that option


Do not fail due to style warnings when using relaxed validation

Fixes https://github.com/hughsie/appstream-glib/issues/36

--- libappstream-glib/as-app-validate.c
+++ libappstream-glib/as-app-validate.c
@@ -47,7 +47,7 @@
  * ai_app_validate_add:
  */
 G_GNUC_PRINTF (3, 4) static void
-ai_app_validate_add (GPtrArray *problems,
+ai_app_validate_add (AsAppValidateHelper *helper,
 		     AsProblemKind kind,
 		     const gchar *fmt, ...)
 {
@@ -60,9 +60,14 @@
 	str = g_strdup_vprintf (fmt, args);
 	va_end (args);

+	/* don't care about style when relaxed */
+	if (helper->flags & AS_APP_VALIDATE_FLAG_RELAX &&
+	    kind == AS_PROBLEM_KIND_STYLE_INCORRECT)
+		return;
+
 	/* already added */
-	for (i = 0; i < problems->len; i++) {
-		problem = g_ptr_array_index (problems, i);
+	for (i = 0; i < helper->probs->len; i++) {
+		problem = g_ptr_array_index (helper->probs, i);
 		if (g_strcmp0 (as_problem_get_message (problem), str) == 0)
 			return;
 	}
@@ -72,7 +77,7 @@
 	as_problem_set_kind (problem, kind);
 	as_problem_set_message (problem, str);
 	g_debug ("Adding %s '%s'", as_problem_kind_to_string (kind), str);
-	g_ptr_array_add (problems, problem);
+	g_ptr_array_add (helper->probs, problem);
 }

 /**
@@ -184,29 +189,29 @@

 	str_len = strlen (text);
 	if (str_len < length_li_min) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<li> is too short [%s]", text);
 	}
 	if (str_len > length_li_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<li> is too long [%s]", text);
 	}
 	if (ai_app_validate_fullstop_ending (text)) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<li> cannot end in '.' [%s]", text);
 	}
 	if (as_app_validate_has_hyperlink (text)) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<li> cannot contain a hyperlink [%s]",
 				     text);
 	}
 	if (require_sentence_case &&
 	    !as_app_validate_has_first_word_capital (helper, text)) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<li> requires sentence case [%s]", text);
 	}
@@ -225,7 +230,7 @@

 	/* empty */
 	if (text == NULL) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> was empty");
 		return;
@@ -240,7 +245,7 @@

 	/* previous was short */
 	if (helper->previous_para_was_short) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> is too short [%s]", text);
 	}
@@ -253,31 +258,31 @@
 		helper->previous_para_was_short = TRUE;
 	}
 	if (str_len > length_para_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> is too long [%s]", text);
 	}
 	if (g_str_has_prefix (text, "This application")) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> should not start with 'This application'");
 	}
 	if (as_app_validate_has_hyperlink (text)) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> cannot contain a hyperlink [%s]",
 				     text);
 	}
 	if (require_sentence_case &&
 	    !as_app_validate_has_first_word_capital (helper, text)) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> requires sentence case [%s]", text);
 	}
 	if (text[str_len - 1] != '.' &&
 	    text[str_len - 1] != '!' &&
 	    text[str_len - 1] != ':') {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> does not end in '.|:|!' [%s]", text);
 	}
@@ -302,7 +307,7 @@

 	/* ul without a leading para */
 	if (helper->number_paragraphs < 1) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<ul> cannot start a description [%s]",
 				     text);
@@ -310,7 +315,7 @@
 	if (!allow_short_para &&
 	    helper->para_chars_before_list != 0 &&
 	    helper->para_chars_before_list < (guint) length_para_before_list) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Not enough <p> content before <ul>");
 	}
@@ -385,17 +390,17 @@

 	/* previous paragraph wasn't long enough */
 	if (helper->previous_para_was_short) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<p> is too short");
 	}
 	if (helper->number_paragraphs < number_para_min) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Not enough <p> tags for a good description");
 	}
 	if (helper->number_paragraphs > number_para_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Too many <p> tags for a good description");
 	}
@@ -465,7 +470,7 @@
 	g_debug ("checking %s", url);
 	base_uri = soup_uri_new (url);
 	if (base_uri == NULL) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_URL_NOT_FOUND,
 				     "<screenshot> url not valid [%s]", url);
 		return FALSE;
@@ -479,7 +484,7 @@
 	/* send sync */
 	status_code = soup_session_send_message (helper->session, msg);
 	if (status_code != SOUP_STATUS_OK) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_URL_NOT_FOUND,
 				     "<screenshot> url not found [%s]", url);
 		return FALSE;
@@ -487,7 +492,7 @@

 	/* check if it's a zero sized file */
 	if (msg->response_body->length == 0) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_FILE_INVALID,
 				     "<screenshot> url is a zero length file [%s]",
 				     url);
@@ -499,7 +504,7 @@
 						      msg->response_body->length,
 						      NULL);
 	if (stream == NULL) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_URL_NOT_FOUND,
 				     "<screenshot> failed to load data [%s]",
 				     url);
@@ -509,7 +514,7 @@
 	/* load the image */
 	pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
 	if (pixbuf == NULL) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_FILE_INVALID,
 				     "<screenshot> failed to load [%s]",
 				     url);
@@ -521,7 +526,7 @@
 	screenshot_height = gdk_pixbuf_get_height (pixbuf);
 	if (as_image_get_width (im) != 0 &&
 	    as_image_get_width (im) != screenshot_width) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> width did not match specified [%s]",
 				     url);
@@ -530,7 +535,7 @@
 	/* check height matches */
 	if (as_image_get_height (im) != 0 &&
 	    as_image_get_height (im) != screenshot_height) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> height did not match specified [%s]",
 				     url);
@@ -538,25 +543,25 @@

 	/* check size is reasonable */
 	if (screenshot_width < ss_size_width_min) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> width too small [%s]",
 				     url);
 	}
 	if (screenshot_height < ss_size_height_min) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> height too small [%s]",
 				     url);
 	}
 	if (screenshot_width > ss_size_width_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> width too large [%s]",
 				     url);
 	}
 	if (screenshot_height > ss_size_height_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> height too large [%s]",
 				     url);
@@ -567,14 +572,14 @@
 	alpha_flags = as_image_get_alpha_flags (im);
 	if ((alpha_flags & AS_IMAGE_ALPHA_FLAG_TOP) > 0||
 	    (alpha_flags & AS_IMAGE_ALPHA_FLAG_BOTTOM) > 0) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<image> has vertical padding [%s]",
 				     url);
 	}
 	if ((alpha_flags & AS_IMAGE_ALPHA_FLAG_LEFT) > 0||
 	    (alpha_flags & AS_IMAGE_ALPHA_FLAG_RIGHT) > 0) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<image> has horizontal padding [%s]",
 				     url);
@@ -586,7 +591,7 @@
 		if (ABS (screenshot_aspect - 1.777777777) > 0.1) {
 			g_debug ("got aspect %.2f, wanted %.2f",
 				 screenshot_aspect, desired_aspect);
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_ASPECT_RATIO_INCORRECT,
 					     "<screenshot> aspect ratio not 16:9 [%s]",
 					     url);
@@ -607,7 +612,7 @@
 	/* blank */
 	url = as_image_get_url (im);
 	if (strlen (url) == 0) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_VALUE_MISSING,
 				     "<screenshot> has no content");
 		return;
@@ -616,7 +621,7 @@
 	/* check for duplicates */
 	ret = as_app_validate_image_url_already_exists (helper, url);
 	if (ret) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_DUPLICATE_DATA,
 				     "<screenshot> has duplicated data");
 		return;
@@ -651,7 +656,7 @@
 	}

 	if (as_screenshot_get_kind (ss) == AS_SCREENSHOT_KIND_UNKNOWN) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<screenshot> has unknown type");
 	}
@@ -664,30 +669,30 @@
 	if (tmp != NULL) {
 		str_len = strlen (tmp);
 		if (str_len < length_caption_min) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<caption> is too short [%s]", tmp);
 		}
 		if (str_len > length_caption_max) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<caption> is too long [%s]", tmp);
 		}
 		if (ai_app_validate_fullstop_ending (tmp)) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<caption> cannot end in '.' [%s]",
 					     tmp);
 		}
 		if (as_app_validate_has_hyperlink (tmp)) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<caption> cannot contain a hyperlink [%s]",
 					     tmp);
 		}
 		if (require_sentence_case &&
 		    !as_app_validate_has_first_word_capital (helper, tmp)) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<caption> requires sentence case [%s]",
 					     tmp);
@@ -716,7 +721,7 @@
 	switch (icon_kind) {
 	case AS_ICON_KIND_STOCK:
 		if (!as_utils_is_stock_icon_name (icon_name)) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "stock icon is not valid [%s]",
 					     icon_name);
@@ -724,7 +729,7 @@
 		break;
 	case AS_ICON_KIND_LOCAL:
 		if (!g_str_has_prefix (icon_name, "/")) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "local icon is not a filename [%s]",
 					     icon_name);
@@ -732,7 +737,7 @@
 		break;
 	case AS_ICON_KIND_CACHED:
 		if (g_str_has_prefix (icon_name, "/")) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "cached icon is a filename [%s]",
 					     icon_name);
@@ -741,7 +746,7 @@
 	case AS_ICON_KIND_REMOTE:
 		if (!g_str_has_prefix (icon_name, "http://") &&
 		    !g_str_has_prefix (icon_name, "https://")) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "remote icon is not a url [%s]",
 					     icon_name);
@@ -782,12 +787,12 @@

 	screenshots = as_app_get_screenshots (app);
 	if (screenshots->len < number_screenshots_min) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Not enough <screenshot> tags");
 	}
 	if (screenshots->len > number_screenshots_max) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Too many <screenshot> tags");
 	}
@@ -796,7 +801,7 @@
 		as_app_validate_screenshot (ss, helper);
 		if (as_screenshot_get_kind (ss) == AS_SCREENSHOT_KIND_DEFAULT) {
 			if (screenshot_has_default) {
-				ai_app_validate_add (helper->probs,
+				ai_app_validate_add (helper,
 						     AS_PROBLEM_KIND_MARKUP_INVALID,
 						     "<screenshot> has more than one default");
 			}
@@ -805,7 +810,7 @@
 		}
 	}
 	if (screenshots->len > 0 && !screenshot_has_default) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_MARKUP_INVALID,
 				     "<screenshots> has no default <screenshot>");
 	}
@@ -830,7 +835,7 @@
 	/* check version */
 	tmp = as_release_get_version (release);
 	if (tmp == NULL) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_MISSING,
 				     "<release> has no version");
 	}
@@ -838,12 +843,12 @@
 	/* check timestamp */
 	timestamp = as_release_get_timestamp (release);
 	if (timestamp == 0) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_MISSING,
 				     "<release> has no timestamp");
 	}
 	if (timestamp > 20120101 && timestamp < 20251231) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<release> timestamp should be a UNIX time");
 	}
@@ -852,7 +857,7 @@
 	tmp = as_release_get_description (release, "C");
 	if (tmp != NULL) {
 		if (as_app_validate_has_hyperlink (tmp)) {
-			ai_app_validate_add (helper->probs,
+			ai_app_validate_add (helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<release> description should be "
 					     "prose and not contain hyperlinks [%s]",
@@ -885,7 +890,7 @@

 	releases = as_app_get_releases (app);
 	if (releases->len > 10) {
-		ai_app_validate_add (helper->probs,
+		ai_app_validate_add (helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "Too many <release> tags");
 	}
@@ -1096,7 +1101,7 @@
 			ret = TRUE;
 		break;
 	case AS_ID_KIND_UNKNOWN:
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<id> has invalid type attribute");

@@ -1111,7 +1116,7 @@
 		break;
 	}
 	if (!ret) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_MARKUP_INVALID,
 				     "<id> does not have correct extension for kind");
 	}
@@ -1121,7 +1126,7 @@
 	if (license != NULL) {
 		if (require_content_license &&
 		    !as_app_validate_is_content_license (license)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "<metadata_license> is not valid [%s]",
 					     license);
@@ -1131,7 +1136,7 @@
 				g_prefix_error (&error_local,
 						"<metadata_license> is not valid [%s]",
 						license);
-				ai_app_validate_add (probs,
+				ai_app_validate_add (&helper,
 						     AS_PROBLEM_KIND_TAG_INVALID,
 						     "%s", error_local->message);
 				g_clear_error (&error_local);
@@ -1142,7 +1147,7 @@
 		switch (as_app_get_source_kind (app)) {
 		case AS_APP_SOURCE_KIND_APPDATA:
 		case AS_APP_SOURCE_KIND_METAINFO:
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_MISSING,
 					     "<metadata_license> is not present");
 			break;
@@ -1159,7 +1164,7 @@
 			g_prefix_error (&error_local,
 					"<project_license> is not valid [%s]",
 					license);
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "%s", error_local->message);
 			g_clear_error (&error_local);
@@ -1169,7 +1174,7 @@
 		switch (as_app_get_source_kind (app)) {
 		case AS_APP_SOURCE_KIND_APPDATA:
 		case AS_APP_SOURCE_KIND_METAINFO:
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_MISSING,
 					     "<project_license> is not present");
 			break;
@@ -1181,7 +1186,7 @@
 	/* pkgname */
 	if (as_app_get_pkgname_default (app) != NULL &&
 	    as_app_get_source_kind (app) == AS_APP_SOURCE_KIND_METAINFO) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_INVALID,
 				     "<pkgname> not allowed in metainfo");
 	}
@@ -1190,7 +1195,7 @@
 	if (as_app_get_extends(app)->len == 0 &&
 	    as_app_get_id_kind (app) == AS_ID_KIND_ADDON &&
 	    as_app_get_source_kind (app) == AS_APP_SOURCE_KIND_METAINFO) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_MISSING,
 				     "<extends> is not present");
 	}
@@ -1199,12 +1204,12 @@
 	update_contact = as_app_get_update_contact (app);
 	if (g_strcmp0 (update_contact,
 		       "someone_who_cares@upstream_project.org") == 0) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_INVALID,
 				     "<update_contact> is still set to a dummy value");
 	}
 	if (update_contact != NULL && strlen (update_contact) < 6) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<update_contact> is too short [%s]",
 				     update_contact);
@@ -1213,7 +1218,7 @@
 		switch (as_app_get_source_kind (app)) {
 		case AS_APP_SOURCE_KIND_APPDATA:
 		case AS_APP_SOURCE_KIND_METAINFO:
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_MISSING,
 					     "<update_contact> is not present");
 			break;
@@ -1227,13 +1232,13 @@
 	if (as_app_get_source_kind (app) == AS_APP_SOURCE_KIND_APPDATA ||
 	    as_app_get_source_kind (app) == AS_APP_SOURCE_KIND_METAINFO) {
 		if ((problems & AS_APP_PROBLEM_NO_XML_HEADER) > 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_MARKUP_INVALID,
 					     "<?xml> header not found");
 		}
 		if (require_copyright &&
 		    (problems & AS_APP_PROBLEM_NO_COPYRIGHT_INFO) > 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_VALUE_MISSING,
 					     "<!-- Copyright [year] [name] --> is not present");
 		}
@@ -1241,7 +1246,7 @@

 	/* check for things that have to exist */
 	if (as_app_get_id (app) == NULL) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_MISSING,
 				     "<id> is not present");
 	}
@@ -1252,7 +1257,7 @@
 	for (l = keys; l != NULL; l = l->next) {
 		key = l->data;
 		if (g_strcmp0 (key, "unknown") == 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "<url> type invalid [%s]", key);
 		}
@@ -1261,7 +1266,7 @@
 			continue;
 		if (!g_str_has_prefix (tmp, "http://") &&
 		    !g_str_has_prefix (tmp, "https://")) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_INVALID,
 					     "<url> does not start with 'http://' [%s]",
 					     tmp);
@@ -1284,36 +1289,36 @@
 	if (name != NULL) {
 		str_len = strlen (name);
 		if (str_len < length_name_min) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<name> is too short [%s]", name);
 		}
 		if (str_len > length_name_max) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<name> is too long [%s]", name);
 		}
 		if (ai_app_validate_fullstop_ending (name)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<name> cannot end in '.' [%s]",
 					     name);
 		}
 		if (as_app_validate_has_hyperlink (name)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<name> cannot contain a hyperlink [%s]",
 					     name);
 		}
 		if (require_sentence_case &&
 		    !as_app_validate_has_first_word_capital (&helper, name)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<name> requires sentence case [%s]",
 					     name);
 		}
 	} else if (require_name) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_MISSING,
 				     "<name> is not present");
 	}
@@ -1323,44 +1328,44 @@
 	if (summary != NULL) {
 		str_len = strlen (summary);
 		if (str_len < length_summary_min) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<summary> is too short [%s]",
 					     summary);
 		}
 		if (str_len > length_summary_max) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<summary> is too long [%s]",
 					     summary);
 		}
 		if (ai_app_validate_fullstop_ending (summary)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<summary> cannot end in '.' [%s]",
 					     summary);
 		}
 		if (as_app_validate_has_hyperlink (summary)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<summary> cannot contain a hyperlink [%s]",
 					     summary);
 		}
 		if (require_sentence_case &&
 		    !as_app_validate_has_first_word_capital (&helper, summary)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<summary> requires sentence case [%s]",
 					     summary);
 		}
 	} else if (require_name) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_TAG_MISSING,
 				     "<summary> is not present");
 	}
 	if (summary != NULL && name != NULL &&
 	    strlen (summary) < strlen (name)) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_STYLE_INCORRECT,
 				     "<summary> is shorter than <name>");
 	}
@@ -1373,7 +1378,7 @@
 						   FALSE,
 						   &error_local);
 		if (!ret) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_MARKUP_INVALID,
 					     "%s", error_local->message);
 			g_error_free (error_local);
@@ -1383,21 +1388,21 @@
 		if (name != NULL &&
 		    as_app_get_name_size (app) == 1 &&
 		    (problems & AS_APP_PROBLEM_INTLTOOL_NAME) == 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TRANSLATIONS_REQUIRED,
 					     "<name> has no translations");
 		}
 		if (summary != NULL &&
 		    as_app_get_comment_size (app) == 1 &&
 		    (problems & AS_APP_PROBLEM_INTLTOOL_SUMMARY) == 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TRANSLATIONS_REQUIRED,
 					     "<summary> has no translations");
 		}
 		if (description != NULL &&
 		    as_app_get_description_size (app) == 1 &&
 		    (problems & AS_APP_PROBLEM_INTLTOOL_DESCRIPTION) == 0) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TRANSLATIONS_REQUIRED,
 					     "<description> has no translations");
 		}
@@ -1408,25 +1413,25 @@
 	if (name != NULL) {
 		str_len = strlen (name);
 		if (str_len < length_name_min) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<developer_name> is too short [%s]",
 					     name);
 		}
 		if (str_len > length_name_max) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<developer_name> is too long [%s]",
 					     name);
 		}
 		if (as_app_validate_has_hyperlink (name)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<developer_name> cannot contain a hyperlink [%s]",
 					     name);
 		}
 		if (as_app_validate_has_email (name)) {
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_STYLE_INCORRECT,
 					     "<developer_name> cannot contain an email address [%s]",
 					     name);
@@ -1435,13 +1440,13 @@

 	/* using deprecated names */
 	if (deprectated_failure && (problems & AS_APP_PROBLEM_DEPRECATED_LICENCE) > 0) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
 				     "<licence> is deprecated, use "
 				     "<metadata_license> instead");
 	}
 	if ((problems & AS_APP_PROBLEM_MULTIPLE_ENTRIES) > 0) {
-		ai_app_validate_add (probs,
+		ai_app_validate_add (&helper,
 				     AS_PROBLEM_KIND_MARKUP_INVALID,
 				     "<application> used more than once");
 	}
@@ -1451,7 +1456,7 @@
 		switch (as_app_get_source_kind (app)) {
 		case AS_APP_SOURCE_KIND_APPDATA:
 		case AS_APP_SOURCE_KIND_METAINFO:
-			ai_app_validate_add (probs,
+			ai_app_validate_add (&helper,
 					     AS_PROBLEM_KIND_TAG_MISSING,
 					     "<url> is not present");
 			break;


groonga standalone: keep all the first line for load command content

load command content may be too large. It's not suitable for keeping
all content even if it's easy to debug.

--- src/groonga.c
+++ src/groonga.c
@@ -501,11 +501,19 @@
     output_context.output = output;
     output_context.is_outputting = false;
     grn_ctx_recv_handler_set(ctx, s_output, &output_context);
+    grn_obj *load_command = grn_ctx_get(ctx, "load", -1);
     if (!argc) {
       grn_obj text;
       GRN_TEXT_INIT(&text, 0);
       while (prompt(ctx, &text) == GRN_SUCCESS) {
-        GRN_TEXT_PUT(ctx, &command, GRN_TEXT_VALUE(&text), GRN_TEXT_LEN(&text));
+        const bool is_loading =
+          (ctx->impl->command.keep.command == load_command);
+        if (!is_loading) {
+          GRN_TEXT_PUT(ctx,
+                       &command,
+                       GRN_TEXT_VALUE(&text),
+                       GRN_TEXT_LEN(&text));
+        }
         grn_ctx_send(ctx, GRN_TEXT_VALUE(&text), GRN_TEXT_LEN(&text), 0);
         if (ctx->stat == GRN_CTX_QUIT) { break; }
       }


Remove needless ;

Remove needless ;

--- src/groonga.c
+++ src/groonga.c
@@ -2179,7 +2179,7 @@
     hc.is_chunked = GRN_FALSE;
     do_htreq(ctx, &hc);
     MUTEX_LOCK_ENSURE(ctx, q_mutex);
-  };
+  }
 exit :
   n_running_threads--;
   GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)",


added semantic for the mesh type

added semantic for the mesh type

--- plugins/mesh/include/mesh/MeshDataAccessCollection.h
+++ plugins/mesh/include/mesh/MeshDataAccessCollection.h
@@ -19,6 +19,7 @@
 public:
     enum ValueType { BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, HALF_FLOAT, FLOAT, DOUBLE };
     enum AttributeSemanticType { POSITION, NORMAL, COLOR, TEXCOORD, TANGENT};
+    enum PrimitiveType { TRIANGLES, QUADS, LINES };

     static constexpr unsigned int convertToGLType(ValueType value_type) {
         unsigned int retval = 0;
@@ -154,6 +155,7 @@
     struct Mesh {
         std::vector<VertexAttribute> attributes;
         IndexData                    indices;
+        PrimitiveType                primitive_type;

         // TODO interleaved flag?
     };
@@ -161,8 +163,8 @@
     MeshDataAccessCollection() = default;
     ~MeshDataAccessCollection() = default;

-    void addMesh(std::vector<VertexAttribute> const& attribs, IndexData const& indices);
-    void addMesh(std::vector<VertexAttribute> && attribs, IndexData const& indices);
+    void addMesh(std::vector<VertexAttribute> const& attribs, IndexData const& indices, PrimitiveType primitive_type = TRIANGLES);
+    void addMesh(std::vector<VertexAttribute>&& attribs, IndexData const& indices, PrimitiveType primitive_type = TRIANGLES);

     // TODO delete functionality

@@ -173,12 +175,14 @@
     std::vector<Mesh> meshes;
 };

-inline void MeshDataAccessCollection::addMesh(std::vector<VertexAttribute> const& attribs, IndexData const& indices) {
-    meshes.push_back({attribs, indices});
+inline void MeshDataAccessCollection::addMesh(std::vector<VertexAttribute> const& attribs, IndexData const& indices,
+    PrimitiveType primitive_type) {
+    meshes.push_back({attribs, indices, primitive_type});
 }

-inline void MeshDataAccessCollection::addMesh(std::vector<VertexAttribute>&& attribs, IndexData const& indices) {
-    meshes.push_back({attribs, indices});
+inline void MeshDataAccessCollection::addMesh(std::vector<VertexAttribute>&& attribs, IndexData const& indices,
+    PrimitiveType primitive_type) {
+    meshes.push_back({attribs, indices, primitive_type});
 }

 inline std::vector<MeshDataAccessCollection::Mesh>& MeshDataAccessCollection::accessMesh() {


Fixing regression in graph_impl_fragment.h

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@7822 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/seqan/graph_types/graph_impl_fragment.h
+++ seqan/projects/library/seqan/graph_types/graph_impl_fragment.h
@@ -163,7 +163,7 @@
 	 Fragment()	 {}

 	 Fragment(TId sqId1, TSize beg1, TId sqId2, TSize beg2, TSize l) :
-	 iseqId1(sqId1), begin1(beg1), seqId2(sqId2), begin2(beg2), len(l), reversed(false)
+	 seqId1(sqId1), begin1(beg1), seqId2(sqId2), begin2(beg2), len(l), reversed(false)
 	 {
 		 SEQAN_CHECKPOINT
 	 }


followup for gsLinearOperator.h

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@7970 e128ff1e-fa79-4151-a8cb-522299a2c450

--- src/gsSolver/gsLinearOperator.h
+++ src/gsSolver/gsLinearOperator.h
@@ -29,10 +29,10 @@
 public:

     /// Shared pointer for gsLinearOperator
-    typedef typename memory::shared< gsLinearOperator >::ptr Ptr;
+    typedef typename memory::shared<gsLinearOperator>::ptr Ptr;

     /// Unique pointer for gsLinearOperator
-    typedef typename memory::unique< gsLinearOperator >::ptr uPtr;
+    typedef typename memory::unique<gsLinearOperator>::ptr uPtr;

     virtual ~gsLinearOperator() {}

@@ -65,10 +65,10 @@
 {
 public:
     /// Shared pointer for gsScaledOp
-    typedef typename memory::shared< gsScaledOp >::ptr Ptr;
+    typedef typename memory::shared<gsScaledOp>::ptr Ptr;

     /// Unique pointer for gsScaledOp
-    typedef typename memory::unique< gsScaledOp>::ptr uPtr;
+    typedef typename memory::unique<gsScaledOp>::ptr uPtr;

     /// Shared pointer for gsLinearOperator
     typedef typename gsLinearOperator<T>::Ptr BasePtr;
@@ -105,10 +105,10 @@
 public:

     /// Shared pointer for gsIdentityOp
-    typedef typename memory::shared< gsIdentityOp >::ptr Ptr;
+    typedef typename memory::shared<gsIdentityOp>::ptr Ptr;

     /// Unique pointer for gsIdentityOp
-    typedef typename memory::unique< gsIdentityOp >::ptr uPtr;
+    typedef typename memory::unique<gsIdentityOp>::ptr uPtr;

     /// Constructor taking the dimension of the identity operator
     gsIdentityOp(index_t dim) : m_dim(dim) {}


bug fix

bug fix

--- vod/filters/audio_filter.c
+++ vod/filters/audio_filter.c
@@ -1333,7 +1333,7 @@
 			rc = source->cur_frame_part.frames_source->start_frame(
 				source->cur_frame_part.frames_source_context,
 				source->cur_frame,
-				ULLONG_MAX);
+				NULL);
 			if (rc != VOD_OK)
 			{
 				return rc;


stm32f4_iocontrol led-server checks for unit ident

--- platform/stm32f4_iocontrol/host_cmds/led-server.c
+++ platform/stm32f4_iocontrol/host_cmds/led-server.c
@@ -46,6 +46,7 @@
 	uint8_t *query;
 	const char *ip = "0.0.0.0";
 	unsigned short port = 1502;
+	int header_len;
 	int opt;

 	while (-1 != (opt = getopt(argc, argv, "a:p:"))) {
@@ -60,6 +61,7 @@
 	}

 	ctx = modbus_new_tcp(ip, port);
+	header_len = modbus_get_header_length(ctx);
 	query = malloc(MODBUS_TCP_MAX_ADU_LENGTH);

 	modbus_set_debug(ctx, TRUE);
@@ -87,6 +89,10 @@
 				break;
 			}

+			if (query[header_len - 1] != MODBUS_TCP_SLAVE) {
+				continue;
+			}
+
 			if (-1 == modbus_reply(ctx, query, query_len, mb_mapping)) {
 				break;
 			}


Tonemap action now does not hide the active window.

--- src/gui_cpp.h
+++ src/gui_cpp.h
@@ -1566,7 +1566,7 @@
     if (imguiButton((TonemapWidgetState::Original == _state.m_selection)?"Restore":"Apply", true, ImguiAlign::CenterIndented))
     {
         _state.m_env = _env;
-        _state.m_events = GuiEvent::HandleAction | GuiEvent::DismissWindow;
+        _state.m_events = GuiEvent::HandleAction;
     }

     if (imguiButton("Close", true, ImguiAlign::CenterIndented))


major revisions for v5.0 release

major revisions for v5.0 release

git-svn-id: 0ef30dc7da0b07cedfa074587325a6c153c0ae55@6443 fdbf22ae-c210-0410-be80-ca943da6b8f8

--- fer/ccr/EF_InternalUtil.c
+++ fer/ccr/EF_InternalUtil.c
@@ -30,7 +30,7 @@
 *  INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 *  CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
-*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
+*  CONNECTION WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

@@ -69,8 +69,8 @@
 /*
  * The memory_ptr, mr_list_ptr and cx_list_ptr are obtained from Ferret
  * and cached whenever they are passed into one of the "efcn_" functions.
- * These pointers can be accessed by the utility functions in libef_util
- * or lib_ef_c_util.  This way the EF writer does not need to see them.
+ * These pointers can be accessed by the utility functions in efn_ext/.
+ * This way the EF writer does not need to see these pointers.
  */

 static LIST  *GLOBAL_ExternalFunctionList;
@@ -83,7 +83,7 @@
 /*
  * The jumpbuffer is used by setjmp() and longjmp().
  * setjmp() is called by efcn_compute_() in EF_InternalUtil.c and
- * saves the stack environment in jimpbuffer for later use by longjmp().
+ * saves the stack environment in jumpbuffer for later use by longjmp().
  * This allows one to bail out of external functions and still
  * return control to Ferret.
  * Check "Advanced Progrmming in the UNIX Environment" by Stevens
@@ -128,6 +128,7 @@
 int  efcn_get_num_reqd_args_( int * );
 void efcn_get_has_vari_args_( int *, int * );
 void efcn_get_axis_will_be_( int *, int * );
+void efcn_get_axis_reduction_( int *, int * );
 void efcn_get_piecemeal_ok_( int *, int * );

 void efcn_get_axis_implied_from_( int *, int *, int * );
@@ -145,7 +146,7 @@
 void efcn_copy_array_dims_(void);
 void efcn_get_workspace_addr_(float *, int *, float *);

-static void sig_fpe_segv_handler(int);
+static void EF_signal_handler(int);

 void ef_err_bail_out_(int *, char *);
 void ef_err_not_found(int);
@@ -173,13 +174,20 @@
  * should pass by reference and should end with an underscore.
  */

+/*
+ * Find all of the ~.so files in directories listed in the
+ * FER_EXTERNAL_FUNCTIONS environment variable and add all
+ * the names and associated directory information to the
+ * GLOBAL_ExternalFunctionList.
+ */
 int efcn_scan_( int *gfcn_num_internal )
 {

   FILE *file_ptr=NULL;
   ExternalFunction ef;

-  char file[EF_MAX_NAME_LENGTH]="", *path=NULL;
+  char file[EF_MAX_NAME_LENGTH]="";
+  char *path_ptr=NULL, path[8192]="";
   char paths[8192]="", cmd[EF_MAX_DESCRIPTION_LENGTH]="";
   int count=0, status=LIST_OK;

@@ -191,7 +199,7 @@
   }

   if ( (GLOBAL_ExternalFunctionList = list_init()) == NULL ) {
-    fprintf(stderr, "ERROR: Unable to initialize GLOBAL_ExternalFunctionList.\n");
+    fprintf(stderr, "ERROR: efcn_scan: Unable to initialize GLOBAL_ExternalFunctionList.\n");
     return_val = -1;
     return return_val;
   }
@@ -208,7 +216,8 @@

   if ( !getenv("FER_EXTERNAL_FUNCTIONS") ) {
     if ( !I_have_warned_already ) {
-      fprintf(stderr, "\nWARNING: environment variable FER_EXTERNAL_FUNCTIONS not defined.\n\n");
+      fprintf(stderr, "\
+\nWARNING: environment variable FER_EXTERNAL_FUNCTIONS not defined.\n\n");
       I_have_warned_already = TRUE;
     }
     return_val = 0;
@@ -217,14 +226,12 @@

   sprintf(paths, "%s", getenv("FER_EXTERNAL_FUNCTIONS"));

-  path = strtok(paths, " \t");
-
-  if (path[strlen(path)-1] != '/')
-    strcat(path, "/");
-
-  if ( path == NULL ) {
+  path_ptr = strtok(paths, " \t");
+
+  if ( path_ptr == NULL ) {

-    fprintf(stderr, "\nWARNING:No paths were found in the environment variable FER_EXTERNAL_FUNCTIONS\n\n");
+    fprintf(stderr, "\
+\nWARNING:No paths were found in the environment variable FER_EXTERNAL_FUNCTIONS.\n\n");

     return_val = 0;
     return return_val;
@@ -233,36 +240,47 @@

     do {

+	  strcpy(path, path_ptr);
+
+      if (path[strlen(path)-1] != '/')
+        strcat(path, "/");
+
       sprintf(cmd, "ls -1 %s", path);

+      /* Open a pipe to the "ls" command */
       if ( (file_ptr = popen(cmd, "r")) == (FILE *) NULL ) {
-	fprintf(stderr, "\nERROR: Cannot open pipe.\n\n");
-	return_val = -1;
-	return return_val;
+	    fprintf(stderr, "\nERROR: Cannot open pipe.\n\n");
+	    return_val = -1;
+	    return return_val;
       }

+      /*
+       * Read a line at a time.
+       * Any ~.so files are assumed to be external functions.
+       */
       while ( fgets(file, EF_MAX_NAME_LENGTH, file_ptr) != NULL ) {

         char *extension;

-	file[strlen(file)-1] = '\0';   /* chop off the carriage return */
-	extension = &file[strlen(file)-3];
-	if ( strcmp(extension, ".so") == 0 ) {
-      file[strlen(file)-3] = '\0'; /* chop off the ".so" */
-	  strcpy(ef.path, path);
-	  strcpy(ef.name, file);
-	  ef.id = *gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
-	  ef.already_have_internals = NO;
-	  ef.internals_ptr = NULL;
-	  list_insert_after(GLOBAL_ExternalFunctionList, &ef, sizeof(ExternalFunction));
-	}
+	    file[strlen(file)-1] = '\0';   /* chop off the carriage return */
+	    extension = &file[strlen(file)-3];
+	    if ( strcmp(extension, ".so") == 0 ) {
+          file[strlen(file)-3] = '\0'; /* chop off the ".so" */
+	      strcpy(ef.path, path);
+	      strcpy(ef.name, file);
+	      ef.id = *gfcn_num_internal + ++count; /* pre-increment because F arrays start at 1 */
+	      ef.already_have_internals = NO;
+	      ef.internals_ptr = NULL;
+	      list_insert_after(GLOBAL_ExternalFunctionList, &ef, sizeof(ExternalFunction));
+	    }
+
       }

       pclose(file_ptr);

-      path = strtok(NULL, " \t");
+      path_ptr = strtok(NULL, " \t"); /* get the next directory */

-    } while ( path != NULL );
+    } while ( path_ptr != NULL );

     I_have_scanned_already = TRUE;
   }
@@ -327,13 +345,13 @@
   strcat(ef_object, ".so");

   /*  if ( (ef_ptr->handle = dlopen(ef_object, RTLD_LAZY)) == NULL ) {*/
-  /*  if ( (ef_ptr->handle = dlopen(ef_object, RTLD_NOW || RTLD_GLOBAL)) == NULL ) { */
+  /* if ( (ef_ptr->handle = dlopen(ef_object, RTLD_NOW || RTLD_GLOBAL)) == NULL ) { */
   /* kob - commented out above line, and removed RTLD_GBAL check from below on
      advice of jc - osf didn't have a definition for RTLD_GLOBAL */
   if ( (ef_ptr->handle = dlopen(ef_object, RTLD_NOW)) == NULL ) {
     fprintf(stderr, "\n\
 ERROR in efcn_gather_info:\n\
-dlopen(%s, RTLD_LAZY) generates the error:\n\
+dlopen(%s, RTLD_NOW) generates the error:\n\
 \t\"%s\"\n", ef_object, dlerror());
     return -1;
   }
@@ -360,6 +378,34 @@
     return return_val;

   } else if ( i_ptr->language == EF_F ) {
+
+    /*
+     * Prepare for bailout possibilities by setting a signal handler for
+     * SIGFPE, SIGSEGV, SIGINT and SIGBUS and then by cacheing the stack
+     * environment with sigsetjmp (for the signal handler) and setjmp
+     * (for the "bail out" utility function).
+     */
+    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGFPE.\n");
+      return;
+    }
+    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGSEGV.\n");
+      return;
+    }
+    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGINT.\n");
+      return;
+    }
+    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGBUS.\n");
+      return;
+    }
+    if (sigsetjmp(sigjumpbuffer, 1) != 0) {
+      /* Warning message printed by signal handler. */
+      return;
+    }
+    canjump = 1;

     /* Information about the overall function */

@@ -375,6 +421,26 @@

     (*f_init_ptr)(id_ptr);

+    /*
+     * Restore the default signal handlers.
+     */
+    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGFPE handler.\n");
+      return;
+    }
+    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGSEGV handler.\n");
+      return;
+    }
+    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGINT handler.\n");
+      return;
+    }
+    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGBUS handler.\n");
+      return;
+    }
+
   }

   return 0;
@@ -405,6 +471,34 @@

   if ( ef_ptr->internals_ptr->language == EF_F ) {

+    /*
+     * Prepare for bailout possibilities by setting a signal handler for
+     * SIGFPE, SIGSEGV, SIGINT and SIGBUS and then by cacheing the stack
+     * environment with sigsetjmp (for the signal handler) and setjmp
+     * (for the "bail out" utility function).
+     */
+    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGFPE.\n");
+      return;
+    }
+    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGSEGV.\n");
+      return;
+    }
+    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGINT.\n");
+      return;
+    }
+    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGBUS.\n");
+      return;
+    }
+    if (sigsetjmp(sigjumpbuffer, 1) != 0) {
+      /* Warning message printed by signal handler. */
+      return;
+    }
+    canjump = 1;
+
     sprintf(tempText, "");
     strcat(tempText, ef_ptr->name);
     strcat(tempText, "_custom_axes_");
@@ -412,6 +506,26 @@
     fptr  = (void (*)(int *))dlsym(ef_ptr->handle, tempText);
     (*fptr)( id_ptr );

+    /*
+     * Restore the default signal handlers.
+     */
+    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGFPE handler.\n");
+      return;
+    }
+    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGSEGV handler.\n");
+      return;
+    }
+    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGINT handler.\n");
+      return;
+    }
+    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGBUS handler.\n");
+      return;
+    }
+
   } else {

     fprintf(stderr, "\nExternal Functions in C are not supported yet.\n\n");
@@ -446,12 +560,60 @@

   if ( ef_ptr->internals_ptr->language == EF_F ) {

+    /*
+     * Prepare for bailout possibilities by setting a signal handler for
+     * SIGFPE, SIGSEGV, SIGINT and SIGBUS and then by cacheing the stack
+     * environment with sigsetjmp (for the signal handler) and setjmp
+     * (for the "bail out" utility function).
+     */
+    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGFPE.\n");
+      return;
+    }
+    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGSEGV.\n");
+      return;
+    }
+    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGINT.\n");
+      return;
+    }
+    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGBUS.\n");
+      return;
+    }
+    if (sigsetjmp(sigjumpbuffer, 1) != 0) {
+      /* Warning message printed by signal handler. */
+      return;
+    }
+    canjump = 1;
+
     sprintf(tempText, "");
     strcat(tempText, ef_ptr->name);
     strcat(tempText, "_result_limits_");

     fptr  = (void (*)(int *))dlsym(ef_ptr->handle, tempText);
     (*fptr)( id_ptr);
+
+    /*
+     * Restore the default signal handlers.
+     */
+    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGFPE handler.\n");
+      return;
+    }
+    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGSEGV handler.\n");
+      return;
+    }
+    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGINT handler.\n");
+      return;
+    }
+    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGBUS handler.\n");
+      return;
+    }

   } else {

@@ -620,17 +782,27 @@

     /*
      * Prepare for bailout possibilities by setting a signal handler for
-     * SIGFPE and SIGSEGV and then by cacheing the stack environment with
-     * sigsetjmp (for the signal handler) and setjmp (for the "bail out"
-     * utility function).
+     * SIGFPE, SIGSEGV, SIGINT and SIGBUS and then by cacheing the stack
+     * environment with sigsetjmp (for the signal handler) and setjmp
+     * (for the "bail out" utility function).
      */
-    if (signal(SIGFPE, sig_fpe_segv_handler) == SIG_ERR) {
+    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_compute() catching SIGFPE.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGSEGV, sig_fpe_segv_handler) == SIG_ERR) {
+    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_compute() catching SIGSEGV.\n");
+      *status = FERR_EF_ERROR;
+      return;
+    }
+    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_compute() catching SIGINT.\n");
+      *status = FERR_EF_ERROR;
+      return;
+    }
+    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_compute() catching SIGBUS.\n");
       *status = FERR_EF_ERROR;
       return;
     }
@@ -642,7 +814,7 @@
     canjump = 1;

     if (setjmp(jumpbuffer) != 0 ) {
-      /* Warning message printed by utility function. */
+      /* Warning message printed by bail-out utility function. */
       *status = FERR_EF_ERROR;
       return;
     }
@@ -835,6 +1007,16 @@
       *status = FERR_EF_ERROR;
       return;
     }
+    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGINT handler.\n");
+      *status = FERR_EF_ERROR;
+      return;
+    }
+    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGBUS handler.\n");
+      *status = FERR_EF_ERROR;
+      return;
+    }

     /*
      * Now it's time to release the work space.
@@ -860,11 +1042,11 @@

 /*
- * A signal handler for SIGFPE and SIGSEGV signals generated
+ * A signal handler for SIGFPE, SIGSEGV, SIGINT and SIGBUS signals generated
  * while executing an external function.  See "Advanced Programming
  * in the UNIX Environment" p. 299 ff for details.
  */
-static void sig_fpe_segv_handler(int signo) {
+static void EF_signal_handler(int signo) {

   if (canjump == 0) return;

@@ -876,6 +1058,14 @@
     fprintf(stderr, "\n\nERROR inexternal function: Segmentation Violation\n");
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
+  } else if (signo == SIGINT) {
+    fprintf(stderr, "\n\nExternal function halted with Control-C\n");
+    canjump = 0;
+    siglongjmp(sigjumpbuffer, 1);
+  } else if (signo == SIGBUS) {
+    fprintf(stderr, "\n\nERROR inexternal function: Hardware Fault\n");
+    canjump = 0;
+    siglongjmp(sigjumpbuffer, 1);
   } else {
     fprintf(stderr, "\n\nERROR inexternal function: signo = %d\n", signo);
     canjump = 0;
@@ -1074,7 +1264,28 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the axis sources (merged, normal, abstract, custom).
+ * fill in the axis_reduction (retained, reduced) information.
+ */
+void efcn_get_axis_reduction_( int *id_ptr, int *array_ptr )
+{
+  ExternalFunction *ef_ptr=NULL;
+
+  if ( (ef_ptr = ef_ptr_from_id_ptr(id_ptr)) == NULL ) { return; }
+
+  array_ptr[X_AXIS] = ef_ptr->internals_ptr->axis_reduction[X_AXIS];
+  array_ptr[Y_AXIS] = ef_ptr->internals_ptr->axis_reduction[Y_AXIS];
+  array_ptr[Z_AXIS] = ef_ptr->internals_ptr->axis_reduction[Z_AXIS];
+  array_ptr[T_AXIS] = ef_ptr->internals_ptr->axis_reduction[T_AXIS];
+
+  return;
+}
+
+
+/*
+ * Find an external function based on its integer ID and
+ * fill in the piecemeal_ok information.  This lets Ferret
+ * know if it's ok to break up a calculation along an axis
+ * for memory management reasons.
  */
 void efcn_get_piecemeal_ok_( int *id_ptr, int *array_ptr )
 {
@@ -1324,6 +1535,7 @@
       i_ptr->work_array_len[j][i] = 1;
     }
     i_ptr->axis_will_be[i] = IMPLIED_BY_ARGS;
+    i_ptr->axis_reduction[i] = RETAINED;
     i_ptr->piecemeal_ok[i] = NO;
   }


moved code to request_get_session()

moved code to request_get_session()

--- src/handler.c
+++ src/handler.c
@@ -65,6 +65,20 @@
 }

 static void
+request_get_session(struct request *request, const char *session_id)
+{
+    session_id_t session_id2 = session_id_parse(session_id);
+
+    assert(request != NULL);
+    assert(request->session == NULL);
+
+    if (session_id2 == 0)
+        return;
+
+    request->session = session_get(session_id2);
+}
+
+static void
 request_args_parse(struct request *request)
 {
     const char *session_id;
@@ -82,11 +96,8 @@
     request->translate.request.param = strmap_get(request->args, "translate");

     session_id = strmap_get(request->args, "session");
-    if (session_id != NULL) {
-        session_id_t session_id2 = session_id_parse(session_id);
-        if (session_id2 != 0)
-            request->session = session_get(session_id2);
-    }
+    if (session_id != NULL)
+        request_get_session(request, session_id);
 }

 static void


- switch to ba2str (#101)

- switch to ba2str (#101)

--- src/hci-ble.c
+++ src/hci-ble.c
@@ -114,7 +114,7 @@
   int hciDeviceId = 0;
   int hciSocket;
   struct hci_dev_info hciDevInfo;
-  bdaddr_t address;
+  char address[18];

   int previousAdapterState = -1;
   int currentAdapterState;
@@ -204,8 +204,8 @@
         }
       }

-      baswap(&address, &hciDevInfo.bdaddr);
-      printf("address %s\n", batostr(&address));
+      ba2str(&hciDevInfo.bdaddr, address);
+      printf("address %s\n", address);
       printf("adapterState %s\n", adapterState);
     }