some more modifications to the cleanup code, i think this is how we want it.

--- src/curl.c
+++ src/curl.c
@@ -189,17 +189,13 @@
         return NULL;
     }
     if (self->multi_stack != NULL) {
-        /* FIXME - what now ??? */
-        if (self->multi_stack->multi_handle == NULL) {
-            /* ??? */
-        }
+        /* Do not remove object from multi stack if the stack is still running */
         if (self->multi_stack->state != NULL) {
             PyErr_SetString(ErrorObject, "cannot invoke cleanup, multi-perform() is running");
             return NULL;
         }
-#if 1
-        /* automatically remove from multi ??? */
-        if (self->handle != NULL)
+        /* Remove object from the multi stack if the multi stack is still valid */
+        if (self->handle != NULL && self->multi_stack->multi_handle != NULL)
         {
             int res;
             res = curl_multi_remove_handle(self->multi_stack->multi_handle, self->handle);
@@ -208,10 +204,6 @@
             }
         }
         self->multi_stack = NULL;
-#else
-        PyErr_SetString(ErrorObject, "cannot invoke cleanup, object still on a multi-stack");
-        return NULL;
-#endif
     }
     self_cleanup(self);
     Py_INCREF(Py_None);
@@ -940,9 +932,10 @@
     if (self->multi_handle != NULL) {
         CURLM *multi_handle = self->multi_handle;
         self->multi_handle = NULL;
-        Py_BEGIN_ALLOW_THREADS
+        /* Cannot allow this to run with the gil held as it will cause a race
+         * with the cleanup handler for the curl objects
+         */
         curl_multi_cleanup(multi_handle);
-        Py_END_ALLOW_THREADS
     }
 }


added support for CURLOPT_HTTP200ALIASES

--- src/curl.c
+++ src/curl.c
@@ -67,6 +67,7 @@
     CurlMultiObject *multi_stack;
     struct curl_httppost *httppost;
     struct curl_slist *httpheader;
+    struct curl_slist *http200aliases;
     struct curl_slist *quote;
     struct curl_slist *postquote;
     struct curl_slist *prequote;
@@ -200,6 +201,7 @@
     self->multi_stack = NULL;
     self->httppost = NULL;
     self->httpheader = NULL;
+    self->http200aliases = NULL;
     self->quote = NULL;
     self->postquote = NULL;
     self->prequote = NULL;
@@ -452,6 +454,7 @@
 #undef SFREE
 #define SFREE(v)   if (v != NULL) (curl_slist_free_all(v), v = NULL)
     SFREE(self->httpheader);
+    SFREE(self->http200aliases);
     SFREE(self->quote);
     SFREE(self->postquote);
     SFREE(self->prequote);
@@ -987,6 +990,9 @@
         struct curl_slist **slist = NULL;

         switch (option) {
+        case CURLOPT_HTTP200ALIASES:
+            slist = &self->http200aliases;
+            break;
         case CURLOPT_HTTPHEADER:
             slist = &self->httpheader;
             break;
@@ -2265,6 +2271,7 @@
     insint_c(d, "SHARE", CURLOPT_SHARE);
     insint_c(d, "PROXYTYPE", CURLOPT_PROXYTYPE);
     insint_c(d, "ENCODING", CURLOPT_ENCODING);
+    insint_c(d, "HTTP200ALIASES", CURLOPT_HTTP200ALIASES);

     /* CURL_NETRC_OPTION: constants for setopt(NETRC, x) */
     insint_c(d, "NETRC_OPTIONAL", CURL_NETRC_OPTIONAL);


geotag-pane: Reverse geocode the location

Part of the fix for: http://bugs.meego.com/show_bug.cgi?id=833

--- src/mps-geotag-pane.c
+++ src/mps-geotag-pane.c
@@ -20,6 +20,7 @@
 #include <champlain/champlain.h>
 #include <geoclue/geoclue-master.h>
 #include <geoclue/geoclue-geocode.h>
+#include <geoclue/geoclue-reverse-geocode.h>
 #include "mps-geotag-pane.h"

 #include <glib/gi18n.h>
@@ -46,7 +47,8 @@
   PROP_LATITUDE,
   PROP_LONGITUDE,
   PROP_GEOTAG_ENABLED,
-  PROP_GUESS_LOCATION
+  PROP_GUESS_LOCATION,
+  PROP_REVERSE_LOCATION
 };

 struct _MpsGeotagPanePrivate {
@@ -54,6 +56,7 @@
   ClutterActor *map_view;
   GeocluePosition *geo_position;
   GeoclueGeocode *geo_geocode;
+  GeoclueReverseGeocode *geo_reverse_geocode;
   ChamplainLayer *markers_layer;
   ClutterActor *your_location_marker;
   ClutterActor *entry;
@@ -71,6 +74,8 @@
   ClutterActor *button_box;
   ClutterActor *use_location_button;
   ClutterActor *dont_use_location_button;
+
+  gchar *reverse_location;
 };

 static guint signals[LAST_SIGNAL] = { 0, };
@@ -101,6 +106,10 @@
       g_value_set_boolean (value,
                            mx_button_get_toggled (MX_BUTTON (priv->guess_location_button)));
       break;
+    case PROP_REVERSE_LOCATION:
+      g_value_set_string (value,
+                          priv->reverse_location);
+      break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   }
@@ -171,6 +180,14 @@
                                 FALSE,
                                 G_PARAM_READABLE);
   g_object_class_install_property (object_class, PROP_GUESS_LOCATION, pspec);
+
+  pspec = g_param_spec_string ("reverse-location",
+                               "Reverse geocoded location",
+                               "The human readable location that was the "
+                               "result of reverse geocoding the lat and lon",
+                               NULL,
+                               G_PARAM_READABLE);
+  g_object_class_install_property (object_class, PROP_REVERSE_LOCATION, pspec);

   signals[LOCATION_CHOSEN] = g_signal_new ("location-chosen",
                                            MPS_TYPE_GEOTAG_PANE,
@@ -277,6 +294,57 @@
 }

 static void
+_reverse_geocode_cb (GeoclueReverseGeocode *rev_geocode,
+                     GHashTable            *details,
+                     GeoclueAccuracy       *accuracy,
+                     GError                *error,
+                     gpointer               userdata)
+{
+  MpsGeotagPane *pane = MPS_GEOTAG_PANE (userdata);
+  MpsGeotagPanePrivate *priv = GET_PRIVATE (pane);
+
+  if (error)
+  {
+    g_warning (G_STRLOC ": Error reverse geocoding: %s", error->message);
+    g_free (priv->reverse_location);
+    priv->reverse_location = NULL;
+  }
+
+  g_free (priv->reverse_location);
+
+  priv->reverse_location = g_strdup (g_hash_table_lookup (details,
+                                                          GEOCLUE_ADDRESS_KEY_AREA));
+  if (!priv->reverse_location)
+    priv->reverse_location = g_strdup (g_hash_table_lookup (details,
+                                                            GEOCLUE_ADDRESS_KEY_LOCALITY));
+  if (!priv->reverse_location)
+    priv->reverse_location = g_strdup (g_hash_table_lookup (details,
+                                                            GEOCLUE_ADDRESS_KEY_REGION));
+  if (!priv->reverse_location)
+    priv->reverse_location = g_strdup (g_hash_table_lookup (details,
+                                                            GEOCLUE_ADDRESS_KEY_COUNTRY));
+
+  g_object_notify (G_OBJECT (pane), "reverse-location");
+}
+
+static void
+mps_geotag_pane_reverse_point (MpsGeotagPane *pane)
+{
+  MpsGeotagPanePrivate *priv = GET_PRIVATE (pane);
+  GeoclueAccuracy *accuracy;
+
+  accuracy = geoclue_accuracy_new (GEOCLUE_ACCURACY_LEVEL_LOCALITY, 0, 0);
+  geoclue_reverse_geocode_position_to_address_async (priv->geo_reverse_geocode,
+                                                     priv->latitude,
+                                                     priv->longitude,
+                                                     accuracy,
+                                                     _reverse_geocode_cb,
+                                                     pane);
+  geoclue_accuracy_free (accuracy);
+
+}
+
+static void
 _geocode_address_to_position_cb (GeoclueGeocode        *geocode,
                                  GeocluePositionFields  fields,
                                  double                 latitude,
@@ -451,6 +519,7 @@
                          NULL);

   priv->geotag_enabled = TRUE;
+  mps_geotag_pane_reverse_point (pane);
   g_signal_emit (pane, signals [LOCATION_CHOSEN], 0);
 }

@@ -550,6 +619,9 @@
   priv->geo_geocode = geoclue_geocode_new ("org.freedesktop.Geoclue.Providers.Yahoo",
                                            "/org/freedesktop/Geoclue/Providers/Yahoo");

+  priv->geo_reverse_geocode = geoclue_reverse_geocode_new ("org.freedesktop.Geoclue.Providers.Geonames",
+                                                           "/org/freedesktop/Geoclue/Providers/Geonames");
+
   g_signal_connect (priv->entry,
                     "button-clicked",
                     (GCallback)_location_search_button_clicked,
@@ -635,6 +707,7 @@

       mps_geotag_pane_update_marker (self, priv->latitude, priv->longitude);
       mps_geotag_pane_ensure_marker_visible (self);
+      mps_geotag_pane_reverse_point (self);
     } else {
       gconf_client_set_bool (priv->gconf_client,
                              STATUS_PANEL_GUESS_LOCATION_KEY,


ret to sym_count

ret to sym_count

--- app/lmiced/lmiced.c
+++ app/lmiced/lmiced.c
@@ -706,6 +706,7 @@

 void symbol_event_thread(void* ptr) {
     int ret;
+    int sym_count;
     server_t *ser = (server_t*)ptr;
     evtfd_t efd = (evtfd_t)((char*)ser->board.addr+SERVER_EVTPOS + SERVER_SYMEVT);
     lmice_symbol_data_t* sym = (lmice_symbol_data_t*)((char*)ser->board.addr+SERVER_SYMPOS);
@@ -732,18 +733,18 @@

         /* Check publish message */
         eal_spin_lock(&sym->lock);
-        ret = sym->count;
-        if(ret >0 && ret <= SYMLIST_LENGTH) {
-            memcpy(symlist, sym->sym, ret*sizeof(lmice_symbol_detail_t));
+        sym_count = sym->count;
+        if(sym_count >0 && sym_count <= SYMLIST_LENGTH) {
+            memcpy(symlist, sym->sym, sym_count*sizeof(lmice_symbol_detail_t));
             sym->count = 0;
-        } else if(ret > SYMLIST_LENGTH) { /* error we have */
-            ret = 0;
+        } else if(sym_count > SYMLIST_LENGTH) { /* error we have */
+            sym_count = 0;
             sym->count = 0;
             lmice_error_log("symbol_event_thread has count error\n");
         }
         eal_spin_unlock(&sym->lock);

-        for(isym = 0; isym<ret; ++isym) {
+        for(isym = 0; isym<sym_count; ++isym) {
             client_t* cli = NULL;
             pubsub_shm_t * ps = NULL;
             lmice_symbol_detail_t* pd = &symlist[isym];


Add more documentation to Context::New in the API header file.

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

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@6130 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- include/v8.h
+++ include/v8.h
@@ -3076,6 +3076,18 @@
    * Returns a persistent handle to the newly allocated context. This
    * persistent handle has to be disposed when the context is no
    * longer used so the context can be garbage collected.
+   *
+   * \param extensions An optional extension configuration containing
+   * the extensions to be installed in the newly created context.
+   *
+   * \param global_template An optional object template from which the
+   * global object for the newly created context will be created.
+   *
+   * \param global_object An optional global object to be reused for
+   * the newly created context. This global object must have been
+   * created by a previous call to Context::New with the same global
+   * template. The state of the global object will be completely reset
+   * and only object identify will remain.
    */
   static Persistent<Context> New(
       ExtensionConfiguration* extensions = NULL,


app/flatpak-complete.c: Fix typo

app/flatpak-complete.c: Fix typo

--- app/flatpak-complete.c
+++ app/flatpak-complete.c
@@ -265,7 +265,7 @@
           if (last_dot == NULL)
             continue; /* Shouldn't really happen */

-          /* Only complete to subrefs is fully matching real part.
+          /* Only complete to subrefs if fully matching real part.
            * For example, only match org.foo.Bar.Sources for
            * "org.foo.Bar", "org.foo.Bar." or "org.foo.Bar.S", but
            * not for "org.foo" or other shorter prefixes.


added QGLContextAdapter

added QGLContextAdapter

--- include/Carna/base/view/GLContext.h
+++ include/Carna/base/view/GLContext.h
@@ -57,6 +57,41 @@

+// ----------------------------------------------------------------------------------
+// QGLContextAdapter
+// ----------------------------------------------------------------------------------
+
+template< typename QGLContext >
+class QGLContextAdapter : public GLContext
+{
+
+    QGLContext& qglcontext;
+
+public:
+
+    QGLContextAdapter( const QGLContext& qglcontext );
+
+    virtual void makeActive() const override;
+
+}; // QGLContextAdapter
+
+
+template< typename QGLContext >
+QGLContextAdapter< QGLContext >::QGLContextAdapter( const QGLContext& qglcontext )
+    : GLContext( qglcontext.format().doubleBuffer() )
+    , qglcontext( const_cast< QGLContext& >( qglcontext ) )
+{
+}
+
+
+template< typename QGLContext >
+void QGLContextAdapter< QGLContext >::makeActive() const
+{
+    qglcontext.makeCurrent();
+}
+
+
+
 }  // namespace Carna :: base :: view

 }  // namespace Carna :: base


* removed the need for BOOST_TYPEOF => replaced by decltype in C++11

--- src/include/schwa/dr/field_defs.h
+++ src/include/schwa/dr/field_defs.h
@@ -1,5 +1,4 @@
 /* -*- Mode: C++; indent-tabs-mode: nil -*- */
-#include <boost/typeof/typeof.hpp>

 namespace schwa {
   namespace dr {
@@ -165,9 +164,9 @@
     };

-    #define DR_FIELD(member_obj_ptr) schwa::dr::FieldDef<BOOST_TYPEOF(member_obj_ptr), member_obj_ptr>
-    #define DR_POINTER(member_obj_ptr, store_obj_ptr) schwa::dr::FieldDefWithStore<BOOST_TYPEOF(member_obj_ptr), member_obj_ptr, BOOST_TYPEOF(store_obj_ptr), store_obj_ptr>
-    #define DR_STORE(member_obj_ptr) schwa::dr::StoreDef<BOOST_TYPEOF(member_obj_ptr), member_obj_ptr>
+    #define DR_FIELD(member_obj_ptr) schwa::dr::FieldDef<decltype(member_obj_ptr), member_obj_ptr>
+    #define DR_POINTER(member_obj_ptr, store_obj_ptr) schwa::dr::FieldDefWithStore<decltype(member_obj_ptr), member_obj_ptr, decltype(store_obj_ptr), store_obj_ptr>
+    #define DR_STORE(member_obj_ptr) schwa::dr::StoreDef<decltype(member_obj_ptr), member_obj_ptr>

   }
 }


Enable tensorflow::tstring stand-in class.

After this CL, tensorflow::tstring will no longer be aliased to std::string.

PiperOrigin-RevId: 288296928
Change-Id: I32a5fa6a8249e22ce226eadb765480ba2943836a

--- tensorflow/core/platform/tstring.h
+++ tensorflow/core/platform/tstring.h
@@ -20,7 +20,7 @@
 #include <string>

 // TODO(b/138799229): Used to toggle until global presubmits pass.
-// #define USE_TSTRING
+#define USE_TSTRING

 #ifdef USE_TSTRING


Explicitly share the entries in insint2().

--- src/curl.c
+++ src/curl.c
@@ -1,4 +1,4 @@
-/* $Id: curl.c,v 1.148 2002/08/14 08:46:44 kjetilja Exp $ */
+/* $Id: curl.c,v 1.149 2002/08/14 10:51:29 mfx Exp $ */

 /* PycURL -- cURL Python module
  *
@@ -1923,12 +1923,25 @@
 static void
 insint2(PyObject *d1, PyObject *d2, char *name, int value)
 {
-    PyObject *v = PyInt_FromLong((long) value);
-    if (v == NULL || (d1 != NULL && PyDict_SetItemString(d1, name, v) != 0))
-        Py_FatalError("pycurl: insint");
-    if (v == NULL || (d2 != NULL && PyDict_SetItemString(d2, name, v) != 0))
-        Py_FatalError("pycurl: insint");
+    PyObject *k, *v;
+
+    /* see implementation of PyDict_SetItemString() */
+    k = PyString_FromString(name);
+    v = PyInt_FromLong((long) value);
+    if (k == NULL || v == NULL)
+        goto error;
+#if 0
+    PyString_InternInPlace(&k);     /* XXX Should we really? */
+#endif
+    if (d1 != NULL && PyDict_SetItem(d1, k, v) != 0)
+        goto error;
+    if (d2 != NULL && PyDict_SetItem(d2, k, v) != 0)
+        goto error;
     Py_DECREF(v);
+    Py_DECREF(k);
+    return;
+error:
+    Py_FatalError("pycurl: insint2");
 }

 static void


Don't pollute API-users' namespaces with overly generic "EXPORT" define.
Review URL: http://codereview.chromium.org/42334

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@1537 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- include/v8.h
+++ include/v8.h
@@ -51,8 +51,8 @@
 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
 // static library or building a program which uses the V8 static library neither
 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
-// The reason for having both EXPORT and EXPORT_INLINE is that classes which
-// have their code inside this header file needs to have __declspec(dllexport)
+// The reason for having both V8EXPORT and V8EXPORT_INLINE is that classes which
+// have their code inside this header file need to have __declspec(dllexport)
 // when building the DLL but cannot have __declspec(dllimport) when building
 // a program which uses the DLL.
 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
@@ -61,14 +61,14 @@
 #endif

 #ifdef BUILDING_V8_SHARED
-#define EXPORT __declspec(dllexport)
-#define EXPORT_INLINE __declspec(dllexport)
+#define V8EXPORT __declspec(dllexport)
+#define V8EXPORT_INLINE __declspec(dllexport)
 #elif USING_V8_SHARED
-#define EXPORT __declspec(dllimport)
-#define EXPORT_INLINE
+#define V8EXPORT __declspec(dllimport)
+#define V8EXPORT_INLINE
 #else
-#define EXPORT
-#define EXPORT_INLINE
+#define V8EXPORT
+#define V8EXPORT_INLINE
 #endif  // BUILDING_V8_SHARED

 #else  // _WIN32
@@ -80,11 +80,11 @@
 // the shared or static V8 library as there is on Windows. Therefore there is
 // no checking of BUILDING_V8_SHARED and USING_V8_SHARED.
 #if defined(__GNUC__) && (__GNUC__ >= 4)
-#define EXPORT __attribute__ ((visibility("default")))
-#define EXPORT_INLINE __attribute__ ((visibility("default")))
+#define V8EXPORT __attribute__ ((visibility("default")))
+#define V8EXPORT_INLINE __attribute__ ((visibility("default")))
 #else  // defined(__GNUC__) && (__GNUC__ >= 4)
-#define EXPORT
-#define EXPORT_INLINE
+#define V8EXPORT
+#define V8EXPORT_INLINE
 #endif  // defined(__GNUC__) && (__GNUC__ >= 4)

 #endif  // _WIN32
@@ -164,7 +164,7 @@
  * behind the scenes and the same rules apply to these values as to
  * their handles.
  */
-template <class T> class EXPORT_INLINE Handle {
+template <class T> class V8EXPORT_INLINE Handle {
  public:

   /**
@@ -252,7 +252,7 @@
  * handle scope are destroyed when the handle scope is destroyed.  Hence it
  * is not necessary to explicitly deallocate local handles.
  */
-template <class T> class EXPORT_INLINE Local : public Handle<T> {
+template <class T> class V8EXPORT_INLINE Local : public Handle<T> {
  public:
   Local();
   template <class S> inline Local(Local<S> that)
@@ -295,7 +295,7 @@
  * different storage cells but rather two references to the same
  * storage cell.
  */
-template <class T> class EXPORT_INLINE Persistent : public Handle<T> {
+template <class T> class V8EXPORT_INLINE Persistent : public Handle<T> {
  public:

   /**
@@ -394,7 +394,7 @@
  * handle and may deallocate it.  The behavior of accessing a handle
  * for which the handle scope has been deleted is undefined.
  */
-class EXPORT HandleScope {
+class V8EXPORT HandleScope {
  public:
   HandleScope();

@@ -426,7 +426,7 @@

   // This Data class is accessible internally through a typedef in the
   // ImplementationUtilities class.
-  class EXPORT Data {
+  class V8EXPORT Data {
    public:
     int extensions;
     void** next;
@@ -454,7 +454,7 @@
 /**
  * The superclass of values and API object templates.
  */
-class EXPORT Data {
+class V8EXPORT Data {
  private:
   Data();
 };
@@ -466,7 +466,7 @@
  * compiling it, and can be stored between compilations.  When script
  * data is given to the compile method compilation will be faster.
  */
-class EXPORT ScriptData {  // NOLINT
+class V8EXPORT ScriptData {  // NOLINT
  public:
   virtual ~ScriptData() { }
   static ScriptData* PreCompile(const char* input, int length);
@@ -480,7 +480,7 @@
 /**
  * The origin, within a file, of a script.
  */
-class EXPORT ScriptOrigin {
+class V8EXPORT ScriptOrigin {
  public:
   ScriptOrigin(Handle<Value> resource_name,
                Handle<Integer> resource_line_offset = Handle<Integer>(),
@@ -501,7 +501,7 @@
 /**
  * A compiled JavaScript script.
  */
-class EXPORT Script {
+class V8EXPORT Script {
  public:

   /**
@@ -535,7 +535,7 @@
 /**
  * An error message.
  */
-class EXPORT Message {
+class V8EXPORT Message {
  public:
   Local<String> Get() const;
   Local<String> GetSourceLine() const;
@@ -582,7 +582,7 @@
 /**
  * The superclass of all JavaScript values and objects.
  */
-class EXPORT Value : public Data {
+class V8EXPORT Value : public Data {
  public:

   /**
@@ -683,14 +683,14 @@
 /**
  * The superclass of primitive values.  See ECMA-262 4.3.2.
  */
-class EXPORT Primitive : public Value { };
+class V8EXPORT Primitive : public Value { };

 /**
  * A primitive boolean value (ECMA-262, 4.3.14).  Either the true
  * or false value.
  */
-class EXPORT Boolean : public Primitive {
+class V8EXPORT Boolean : public Primitive {
  public:
   bool Value() const;
   static inline Handle<Boolean> New(bool value);
@@ -700,7 +700,7 @@
 /**
  * A JavaScript string value (ECMA-262, 4.3.17).
  */
-class EXPORT String : public Primitive {
+class V8EXPORT String : public Primitive {
  public:

   /**
@@ -750,7 +750,7 @@
    * ExternalStringResource to manage the life cycle of the underlying
    * buffer.  Note that the string data must be immutable.
    */
-  class EXPORT ExternalStringResource {  // NOLINT
+  class V8EXPORT ExternalStringResource {  // NOLINT
    public:
     /**
      * Override the destructor to manage the life cycle of the underlying
@@ -780,7 +780,7 @@
    * Use String::New or convert to 16 bit data for non-ASCII.
    */

-  class EXPORT ExternalAsciiStringResource {  // NOLINT
+  class V8EXPORT ExternalAsciiStringResource {  // NOLINT
    public:
     /**
      * Override the destructor to manage the life cycle of the underlying
@@ -880,7 +880,7 @@
    * Converts an object to a utf8-encoded character array.  Useful if
    * you want to print the object.
    */
-  class EXPORT Utf8Value {
+  class V8EXPORT Utf8Value {
    public:
     explicit Utf8Value(Handle<v8::Value> obj);
     ~Utf8Value();
@@ -899,7 +899,7 @@
    * Converts an object to an ascii string.
    * Useful if you want to print the object.
    */
-  class EXPORT AsciiValue {
+  class V8EXPORT AsciiValue {
    public:
     explicit AsciiValue(Handle<v8::Value> obj);
     ~AsciiValue();
@@ -917,7 +917,7 @@
   /**
    * Converts an object to a two-byte string.
    */
-  class EXPORT Value {
+  class V8EXPORT Value {
    public:
     explicit Value(Handle<v8::Value> obj);
     ~Value();
@@ -937,7 +937,7 @@
 /**
  * A JavaScript number value (ECMA-262, 4.3.20)
  */
-class EXPORT Number : public Primitive {
+class V8EXPORT Number : public Primitive {
  public:
   double Value() const;
   static Local<Number> New(double value);
@@ -950,7 +950,7 @@
 /**
  * A JavaScript value representing a signed integer.
  */
-class EXPORT Integer : public Number {
+class V8EXPORT Integer : public Number {
  public:
   static Local<Integer> New(int32_t value);
   int64_t Value() const;
@@ -963,7 +963,7 @@
 /**
  * A JavaScript value representing a 32-bit signed integer.
  */
-class EXPORT Int32 : public Integer {
+class V8EXPORT Int32 : public Integer {
  public:
   int32_t Value() const;
  private:
@@ -974,7 +974,7 @@
 /**
  * A JavaScript value representing a 32-bit unsigned integer.
  */
-class EXPORT Uint32 : public Integer {
+class V8EXPORT Uint32 : public Integer {
  public:
   uint32_t Value() const;
  private:
@@ -985,7 +985,7 @@
 /**
  * An instance of the built-in Date constructor (ECMA-262, 15.9).
  */
-class EXPORT Date : public Value {
+class V8EXPORT Date : public Value {
  public:
   static Local<Value> New(double time);

@@ -1009,7 +1009,7 @@
 /**
  * A JavaScript object (ECMA-262, 4.3.3)
  */
-class EXPORT Object : public Value {
+class V8EXPORT Object : public Value {
  public:
   bool Set(Handle<Value> key,
            Handle<Value> value,
@@ -1086,7 +1086,7 @@
 /**
  * An instance of the built-in array constructor (ECMA-262, 15.4.2).
  */
-class EXPORT Array : public Object {
+class V8EXPORT Array : public Object {
  public:
   uint32_t Length() const;

@@ -1100,7 +1100,7 @@
 /**
  * A JavaScript function object (ECMA-262, 15.3).
  */
-class EXPORT Function : public Object {
+class V8EXPORT Function : public Object {
  public:
   Local<Object> NewInstance() const;
   Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
@@ -1118,7 +1118,7 @@
  * mainly used to associate c++ data structures with JavaScript
  * objects.
  */
-class EXPORT External : public Value {
+class V8EXPORT External : public Value {
  public:
   static Local<External> New(void* value);
   static External* Cast(Value* obj);
@@ -1134,7 +1134,7 @@
 /**
  * The superclass of object and function templates.
  */
-class EXPORT Template : public Data {
+class V8EXPORT Template : public Data {
  public:
   /** Adds a property to each instance created by this template.*/
   void Set(Handle<String> name, Handle<Data> value,
@@ -1154,7 +1154,7 @@
  * including the receiver, the number and values of arguments, and
  * the holder of the function.
  */
-class EXPORT Arguments {
+class V8EXPORT Arguments {
  public:
   inline int Length() const;
   inline Local<Value> operator[](int i) const;
@@ -1184,7 +1184,7 @@
  * The information passed to an accessor callback about the context
  * of the property access.
  */
-class EXPORT AccessorInfo {
+class V8EXPORT AccessorInfo {
  public:
   inline AccessorInfo(Local<Object> self,
                       Local<Value> data,
@@ -1438,7 +1438,7 @@
  *   child_instance.instance_property == 3;
  * \endcode
  */
-class EXPORT FunctionTemplate : public Template {
+class V8EXPORT FunctionTemplate : public Template {
  public:
   /** Creates a function template.*/
   static Local<FunctionTemplate> New(
@@ -1530,7 +1530,7 @@
  * Properties added to an ObjectTemplate are added to each object
  * created from the ObjectTemplate.
  */
-class EXPORT ObjectTemplate : public Template {
+class V8EXPORT ObjectTemplate : public Template {
  public:
   /** Creates an ObjectTemplate. */
   static Local<ObjectTemplate> New();
@@ -1672,7 +1672,7 @@
  * A Signature specifies which receivers and arguments a function can
  * legally be called with.
  */
-class EXPORT Signature : public Data {
+class V8EXPORT Signature : public Data {
  public:
   static Local<Signature> New(Handle<FunctionTemplate> receiver =
                                   Handle<FunctionTemplate>(),
@@ -1687,7 +1687,7 @@
  * A utility for determining the type of objects based on the template
  * they were constructed from.
  */
-class EXPORT TypeSwitch : public Data {
+class V8EXPORT TypeSwitch : public Data {
  public:
   static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
   static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
@@ -1703,7 +1703,7 @@
 /**
  * Ignore
  */
-class EXPORT Extension {  // NOLINT
+class V8EXPORT Extension {  // NOLINT
  public:
   Extension(const char* name,
             const char* source = 0,
@@ -1735,13 +1735,13 @@
 };

-void EXPORT RegisterExtension(Extension* extension);
+void V8EXPORT RegisterExtension(Extension* extension);

 /**
  * Ignore
  */
-class EXPORT DeclareExtension {
+class V8EXPORT DeclareExtension {
  public:
   inline DeclareExtension(Extension* extension) {
     RegisterExtension(extension);
@@ -1752,17 +1752,17 @@
 // --- S t a t i c s ---

-Handle<Primitive> EXPORT Undefined();
-Handle<Primitive> EXPORT Null();
-Handle<Boolean> EXPORT True();
-Handle<Boolean> EXPORT False();
+Handle<Primitive> V8EXPORT Undefined();
+Handle<Primitive> V8EXPORT Null();
+Handle<Boolean> V8EXPORT True();
+Handle<Boolean> V8EXPORT False();

 /**
  * A set of constraints that specifies the limits of the runtime's
  * memory use.
  */
-class EXPORT ResourceConstraints {
+class V8EXPORT ResourceConstraints {
  public:
   ResourceConstraints();
   int max_young_space_size() const { return max_young_space_size_; }
@@ -1796,13 +1796,13 @@
  * operation; the caller must return immediately and only after the exception
  * has been handled does it become legal to invoke JavaScript operations.
  */
-Handle<Value> EXPORT ThrowException(Handle<Value> exception);
+Handle<Value> V8EXPORT ThrowException(Handle<Value> exception);

 /**
  * Create new error objects by calling the corresponding error object
  * constructor with the message.
  */
-class EXPORT Exception {
+class V8EXPORT Exception {
  public:
   static Local<Value> RangeError(Handle<String> message);
   static Local<Value> ReferenceError(Handle<String> message);
@@ -1852,7 +1852,7 @@
 /**
  * Container class for static utility functions.
  */
-class EXPORT V8 {
+class V8EXPORT V8 {
  public:
   /** Set the callback to invoke in case of fatal errors. */
   static void SetFatalErrorHandler(FatalErrorCallback that);
@@ -2017,7 +2017,7 @@
 /**
  * An external exception handler.
  */
-class EXPORT TryCatch {
+class V8EXPORT TryCatch {
  public:

   /**
@@ -2096,7 +2096,7 @@
 /**
  * Ignore
  */
-class EXPORT ExtensionConfiguration {
+class V8EXPORT ExtensionConfiguration {
  public:
   ExtensionConfiguration(int name_count, const char* names[])
       : name_count_(name_count), names_(names) { }
@@ -2111,7 +2111,7 @@
  * A sandboxed execution context with its own set of built-in objects
  * and functions.
  */
-class EXPORT Context {
+class V8EXPORT Context {
  public:
   /** Returns the global object of the context. */
   Local<Object> Global();
@@ -2170,7 +2170,7 @@
    * Stack-allocated class which sets the execution context for all
    * operations executed within a local scope.
    */
-  class EXPORT Scope {
+  class V8EXPORT Scope {
    public:
     inline Scope(Handle<Context> context) : context_(context) {
       context_->Enter();
@@ -2256,14 +2256,14 @@
  * // V8 Now no longer locked.
  * \endcode
  */
-class EXPORT Unlocker {
+class V8EXPORT Unlocker {
  public:
   Unlocker();
   ~Unlocker();
 };

-class EXPORT Locker {
+class V8EXPORT Locker {
  public:
   Locker();
   ~Locker();
@@ -2474,8 +2474,8 @@
 }  // namespace v8

-#undef EXPORT
-#undef EXPORT_INLINE
+#undef V8EXPORT
+#undef V8EXPORT_INLINE
 #undef TYPE_CHECK


Remove '#if 0' block that was accidentally left in.

--- include/GL/internal/dri_interface.h
+++ include/GL/internal/dri_interface.h
@@ -37,12 +37,6 @@

 #ifndef DRI_INTERFACE_H
 #define DRI_INTERFACE_H
-
-#if 0 /*ndef DRI_NEW_INTERFACE_ONLY*/
-# include <X11/X.h>
-# include <GL/glx.h>
-# include "GL/glxint.h"
-#endif

 #include <GL/internal/glcore.h>
 #include <xf86drm.h>


EnumCvar set value from string fix

EnumCvar set value from string fix

--- src/cvar.c
+++ src/cvar.c
@@ -588,6 +588,7 @@
 	cvar_t* safenext;
 	cvar_t* safehashNext;
 	char latchedStr[8192];
+	int i;

 	Sys_EnterCriticalSection(CRITSECT_CVAR);

@@ -660,6 +661,9 @@
 			case CVAR_ENUM:
 				var->resetInteger = value.enumval.integer;
 				var->limits.imin = 0;
+				for(i = 0; value.enumval.strings[i]; ++i);
+				var->limits.imax = i -1;
+				assert(var->limits.imax >= 0);
 				var->limits.enumStr = value.enumval.strings;
 				break;
 			case CVAR_INT:


index-pack: Chain the struct base_data on the stack for traversal

We need to release earlier inflated base objects when memory gets
low, which means we need to be able to walk up or down the stack
to locate the objects we want to release, and free their data.

The new link/unlink routines allow inserting and removing the struct
base_data during recursion inside resolve_delta, and the global
base_cache gives us the head of the chain (bottom of the stack)
so we can traverse it.

Signed-off-by: Shawn O. Pearce <f01032651c12a22b2103346ba96b3b6b231f9d3c@spearce.org>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- index-pack.c
+++ index-pack.c
@@ -27,6 +27,8 @@
 };

 struct base_data {
+	struct base_data *base;
+	struct base_data *child;
 	void *data;
 	unsigned long size;
 };
@@ -48,6 +50,7 @@

 static struct object_entry *objects;
 static struct delta_entry *deltas;
+static struct base_data *base_cache;
 static int nr_objects;
 static int nr_deltas;
 static int nr_resolved_deltas;
@@ -213,6 +216,27 @@
 	vsnprintf(buf, sizeof(buf), format, params);
 	va_end(params);
 	die("pack has bad object at offset %lu: %s", offset, buf);
+}
+
+static void link_base_data(struct base_data *base, struct base_data *c)
+{
+	if (base)
+		base->child = c;
+	else
+		base_cache = c;
+
+	c->base = base;
+	c->child = NULL;
+}
+
+static void unlink_base_data(struct base_data *c)
+{
+	struct base_data *base = c->base;
+	if (base)
+		base->child = NULL;
+	else
+		base_cache = NULL;
+	free(c->data);
 }

 static void *unpack_entry_data(unsigned long offset, unsigned long size)
@@ -451,6 +475,8 @@
 	sha1_object(result.data, result.size, type, delta_obj->idx.sha1);
 	nr_resolved_deltas++;

+	link_base_data(base_obj, &result);
+
 	hashcpy(delta_base.sha1, delta_obj->idx.sha1);
 	if (!find_delta_children(&delta_base, &first, &last)) {
 		for (j = first; j <= last; j++) {
@@ -470,7 +496,7 @@
 		}
 	}

-	free(result.data);
+	unlink_base_data(&result);
 }

 static int compare_delta_entry(const void *a, const void *b)
@@ -561,6 +587,7 @@
 			continue;
 		base_obj.data = get_data_from_pack(obj);
 		base_obj.size = obj->size;
+		link_base_data(NULL, &base_obj);

 		if (ref)
 			for (j = ref_first; j <= ref_last; j++) {
@@ -574,7 +601,7 @@
 				if (child->real_type == OBJ_OFS_DELTA)
 					resolve_delta(child, &base_obj, obj->type);
 			}
-		free(base_obj.data);
+		unlink_base_data(&base_obj);
 		display_progress(progress, nr_resolved_deltas);
 	}
 }
@@ -669,6 +696,7 @@
 		base_obj.data = read_sha1_file(d->base.sha1, &type, &base_obj.size);
 		if (!base_obj.data)
 			continue;
+		link_base_data(NULL, &base_obj);

 		find_delta_children(&d->base, &first, &last);
 		for (j = first; j <= last; j++) {
@@ -682,7 +710,7 @@
 			die("local object %s is corrupt", sha1_to_hex(d->base.sha1));
 		append_obj_to_pack(d->base.sha1, base_obj.data,
 			base_obj.size, type);
-		free(base_obj.data);
+		unlink_base_data(&base_obj);
 		display_progress(progress, nr_resolved_deltas);
 	}
 	free(sorted_by_pos);


[Kinetics] Change temperatures used for P-log validation

For rate expressions with negative activation energies, evaluating at
unphysically low temperatures (e.g. 1 K) could lead to overflows in calculating
exp(Ea/RT) that are not indicative of problems at more reasonable temperatures.

git-svn-id: e76dbe14710aecee1ad27675521492cea2578c83@3071 02a645c2-efd0-11dd-984d-ab748d24aa7e

--- include/cantera/kinetics/RxnRates.h
+++ include/cantera/kinetics/RxnRates.h
@@ -523,12 +523,12 @@
     //! issue when one of the Arrhenius expressions at a particular pressure
     //! has a negative pre-exponential factor.
     void validate(const ReactionData& rdata) {
-        double T[] = {1.0, 10.0, 100.0, 1000.0, 10000.0};
+        double T[] = {200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0};
         for (pressureIter iter = pressures_.begin();
                 iter->first < 1000;
                 iter++) {
             update_C(&iter->first);
-            for (size_t i=0; i < 5; i++) {
+            for (size_t i=0; i < 6; i++) {
                 double k = updateRC(log(T[i]), 1.0/T[i]);
                 if (!(k >= 0)) {
                     // k is NaN. Increment the iterator so that the error


Fixed Ausgabe(Falsches Zeichen)

Fixed Ausgabe(Falsches Zeichen)

--- src/dbio.c
+++ src/dbio.c
@@ -489,7 +489,7 @@

-        sprintf(Buffer,"Kreuz %s(%.2f Km) --- %s . %s",meineGefiltertenKnoten[0].Name,meineGefiltertenKnoten[0].AutobahnKM,meineGefiltertenKnoten[0].AutobahnName,Buffer2);
+        sprintf(Buffer,"Kreuz %s(%.2f Km) --- %s -> %s",meineGefiltertenKnoten[0].Name,meineGefiltertenKnoten[0].AutobahnKM,meineGefiltertenKnoten[0].AutobahnName,Buffer2);
         printAutobahnRow(Buffer, TotalSize);

@@ -525,7 +525,7 @@
                 }
             }

-            sprintf(Buffer,"=  |  #  |  =    Kreuz  %s(%.2f Km) --- %s . %s",meineGefiltertenKnoten[x].Name,meineGefiltertenKnoten[x].AutobahnKM,meineGefiltertenKnoten[x].AutobahnName,Buffer2);
+            sprintf(Buffer,"=  |  #  |  =    Kreuz  %s(%.2f Km) --- %s -> %s",meineGefiltertenKnoten[x].Name,meineGefiltertenKnoten[x].AutobahnKM,meineGefiltertenKnoten[x].AutobahnName,Buffer2);
             printAutobahnRow(Buffer, TotalSize);

             printAutobahnRow(" \\ |  #  | /", TotalSize);
@@ -574,7 +574,7 @@
                 }
             }

-            sprintf(Buffer,"Kreuz %s(%.2f Km) --- %s . %s",meineGefiltertenKnoten[x].Name,meineGefiltertenKnoten[x].AutobahnKM,meineGefiltertenKnoten[x].AutobahnName,Buffer2);
+            sprintf(Buffer,"Kreuz %s(%.2f Km) --- %s -> %s",meineGefiltertenKnoten[x].Name,meineGefiltertenKnoten[x].AutobahnKM,meineGefiltertenKnoten[x].AutobahnName,Buffer2);
             printAutobahnRow(Buffer, TotalSize);

@@ -688,7 +688,7 @@
                     }
                 }

-                sprintf(Buffer, "%s (%s . %s)", meineGefiltertenKnoten[x].Name, meineGefiltertenKnoten[x].AutobahnName, Buffer2);
+                sprintf(Buffer, "%s (%s -> %s)", meineGefiltertenKnoten[x].Name, meineGefiltertenKnoten[x].AutobahnName, Buffer2);
                 char *TmpKM = malloc(sizeof(char) * 1000);
                 sprintf(TmpKM, "%f", meineGefiltertenKnoten[x].AutobahnKM);

@@ -738,7 +738,7 @@
                     }
                 }

-                sprintf(Buffer, "\"%s\" Kreuz von %s . %s", meineGefiltertenKnoten[x].Name, meineGefiltertenKnoten[x].AutobahnName, Buffer2);
+                sprintf(Buffer, "\"%s\" Kreuz von %s -> %s", meineGefiltertenKnoten[x].Name, meineGefiltertenKnoten[x].AutobahnName, Buffer2);
                 char *TmpKM = malloc(sizeof(char) * 1000);
                 sprintf(TmpKM, "%f", meineGefiltertenKnoten[x].AutobahnKM);
                 printTabelRow(2, Buffer, TmpKM);


more work on QCircuit class

more work on QCircuit class

--- include/experimental/experimental.h
+++ include/experimental/experimental.h
@@ -483,8 +483,9 @@
             os << ", name = \"\"\n";

         idx gates_size = gates_.size();
+        idx measurements_size = measurements_.size();
+        // should be the same as measurements_size
         idx measurement_steps_size = measurement_steps_.size();
-        idx measurements_size = measurements_.size();

         idx measurement_ip = 0; // measurement instruction pointer
         for (idx i = 0; i <= gates_size; ++i) {
@@ -499,7 +500,7 @@
                     while (measurement_ip < measurements_size &&
                            measurement_steps_[measurement_ip] ==
                                current_measurement_step) {
-                        //std::cout << measurement_ip << std::endl;
+                        // std::cout << measurement_ip << std::endl;
                         os << measurements_[measurement_ip].measurement_type_
                            << ", "
                            << "\"" << measurements_[measurement_ip].name_


Updates to the demo stuff

Updates to the demo stuff

--- src/demo.c
+++ src/demo.c
@@ -1,6 +1,5 @@
 #include <stdlib.h>
 #include <msgpack.h>
-
 #include "array_decoders.c"
 #include "decoders.c"

@@ -22,8 +21,16 @@
     const char * bytes = t_object.via.bin.ptr;
     printf("Param: %d\n",get_param(bytes));
     printf("Strategy: %d\n",get_strategy(bytes));
-    printf("Len: %d\n",get_len(bytes));
-    //convert_to_int_32(bytes);
+    int my_len = get_len(bytes);
+    printf("This\n");
+    printf("Len: %d\n",my_len);
+    printf("This\n");
+    int32_t* data = convert_to_int_16(bytes);
+    printf("Converted");
+    unsigned long out_len = (unsigned long) my_len;
+    printf("Got Len");
+    run_length_decode(data, sizeof(data)/4, &out_len);
+    printf("Structure decoded");
 }

 void parse_msgpack(char *buffer,int msgsize){
@@ -32,12 +39,7 @@
     msgpack_object *deserialized;
     msgpack_unpack(buffer, msgsize, NULL, &mempool, deserialized);
     decode_struct(deserialized);
-
-printf("test 1\n");
-
     msgpack_zone_destroy(&mempool);
-
-printf("test 2\n");
 }

 void read_file(char *name)
@@ -71,27 +73,13 @@
 	fread(buffer, fileLen, 1, file);
 	fclose(file);
 	parse_msgpack(buffer, fileLen);
-
-printf("test 3\n");
-
 	free(buffer);
-
-printf("test 4\n");
 }

 int main(void)
 {
-//	read_file("../data/4HHB.mmtf");
+	read_file("../data/4HHB.mmtf");

-	int32_t input[] = { 100, 100, 100, 100, 50, 50 };
-
-	unsigned long output_length;
-	float* output = integer_decode( input, 6, 100, &output_length );
-	int i;
-	for(i = 0; i < 6; ++i ) {
-		printf( "%f\n", output[i] );
-	}
-	free( output );
 }


Fix build regression with old (Xcode 5.1) clangs.

--- include/gtest/internal/gtest-port.h
+++ include/gtest/internal/gtest-port.h
@@ -499,10 +499,14 @@
 #  endif  // _HAS_EXCEPTIONS
 #  define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
 # elif defined(__clang__)
-// __EXCEPTIONS determines if cleanups are enabled. In Obj-C++ files, there can
-// be cleanups for ObjC exceptions, but C++ exceptions might still be disabled.
-// So use a __has_feature check for C++ exceptions instead.
-#  define GTEST_HAS_EXCEPTIONS __has_feature(cxx_exceptions)
+// clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714,
+// but iff cleanups are enabled after that. In Obj-C++ files, there can be
+// cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions
+// are disabled. clang has __has_feature(cxx_exceptions) which checks for C++
+// exceptions starting at clang r206352, but which checked for cleanups prior to
+// that. To reliably check for C++ exception availability with clang, check for
+// __EXCEPTIONS && __has_feature(cxx_exceptions).
+#  define GTEST_HAS_EXCEPTIONS __EXCEPTIONS && __has_feature(cxx_exceptions)
 # elif defined(__GNUC__) && __EXCEPTIONS
 // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
 #  define GTEST_HAS_EXCEPTIONS 1


Adds support for death tests in OpenBSD (by Paweł Hajdan Jr.)

--- include/gtest/internal/gtest-port.h
+++ include/gtest/internal/gtest-port.h
@@ -91,6 +91,7 @@
 //     GTEST_OS_LINUX_ANDROID - Google Android
 //   GTEST_OS_MAC      - Mac OS X
 //   GTEST_OS_NACL     - Google Native Client (NaCl)
+//   GTEST_OS_OPENBSD  - OpenBSD
 //   GTEST_OS_SOLARIS  - Sun Solaris
 //   GTEST_OS_SYMBIAN  - Symbian
 //   GTEST_OS_WINDOWS  - Windows (Desktop, MinGW, or Mobile)
@@ -242,6 +243,8 @@
 # define GTEST_OS_HPUX 1
 #elif defined __native_client__
 # define GTEST_OS_NACL 1
+#elif defined __OpenBSD__
+# define GTEST_OS_OPENBSD 1
 #endif  // __CYGWIN__

 // Brings in definitions for functions used in the testing::internal::posix
@@ -540,7 +543,8 @@
 // pops up a dialog window that cannot be suppressed programmatically.
 #if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
      (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
-     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX)
+     GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
+     GTEST_OS_OPENBSD)
 # define GTEST_HAS_DEATH_TEST 1
 # include <vector>  // NOLINT
 #endif


headers_check fix: tc_ematch/tc_em_cmp.h

fix the following 'make headers_check' warning:

  usr/include/linux/tc_ematch/tc_em_cmp.h:8: found __[us]{8,16,32,64} type without #include <linux/types.h>

Signed-off-by: Jaswinder Singh Rajput <0599c1aba1ea3f0bcaf4115dd8076db98ee6d35c@gmail.com>

--- include/linux/tc_ematch/tc_em_cmp.h
+++ include/linux/tc_ematch/tc_em_cmp.h
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_EM_CMP_H
 #define __LINUX_TC_EM_CMP_H

+#include <linux/types.h>
 #include <linux/pkt_cls.h>

 struct tcf_em_cmp


Express one of MachineOperand's many constructors in terms of another, by means of default arguments.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@11343 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/CodeGen/MachineInstr.h
+++ include/llvm/CodeGen/MachineInstr.h
@@ -129,13 +129,7 @@
   int regNum;	                // register number for an explicit register
                                 // will be set for a value after reg allocation
 private:
-  MachineOperand()
-    : immedVal(0),
-      flags(0),
-      opType(MO_VirtualRegister),
-      regNum(-1) {}
-
-  MachineOperand(int64_t ImmVal, MachineOperandType OpTy)
+  MachineOperand(int64_t ImmVal = 0, MachineOperandType OpTy = MO_VirtualRegister)
     : immedVal(ImmVal),
       flags(0),
       opType(OpTy),


handle remote shutdown correctly

handle remote shutdown correctly

--- src/network_openssl.c
+++ src/network_openssl.c
@@ -61,6 +61,12 @@
 				switch ((ssl_r = SSL_get_error(con->ssl, r))) {
 				case SSL_ERROR_WANT_WRITE:
 					break;
+				case SSL_ERROR_ZERO_RETURN:
+					/* clean shutdown on the remote side */
+
+					if (r == 0) return -2;
+
+					/* fall thourgh */
 				default:
 					log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
 							ssl_r, r,
@@ -88,7 +94,6 @@
 			char *p;
 # endif

-			WP();
 			if (HANDLER_GO_ON != file_cache_get_entry(srv, con, c->data.file.name, &(con->fce))) {
 				log_error_write(srv, __FILE__, __LINE__, "sb",
 						strerror(errno), c->data.file.name);
@@ -124,6 +129,17 @@
 				switch ((ssl_r = SSL_get_error(con->ssl, r))) {
 				case SSL_ERROR_WANT_WRITE:
 					break;
+				case SSL_ERROR_ZERO_RETURN:
+					/* clean shutdown on the remote side */
+
+					if (r == 0) {
+#if defined USE_MMAP
+						munmap(p, c->data.file.length);
+#endif
+						return -2;
+					}
+
+					/* fall thourgh */
 				default:
 					log_error_write(srv, __FILE__, __LINE__, "sdds", "SSL:",
 							ssl_r, r,


Add support for structured printing

Add support for structured printing

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@4432 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/CodeGen/MachineInstr.h
+++ include/llvm/CodeGen/MachineInstr.h
@@ -16,6 +16,7 @@
 class Value;
 class Function;
 class MachineBasicBlock;
+class TargetMachine;

 typedef int MachineOpCode;

@@ -325,7 +326,8 @@

   //
   // Debugging support
-  //
+  //
+  void print(std::ostream &OS, const TargetMachine &TM);
   void dump() const;
   friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr);


fix nav missing channels after resize

fix nav missing channels after resize

--- src/draw.c
+++ src/draw.c
@@ -547,24 +547,27 @@
 	draw_cursor_pos(1, 1);
 	draw_clear_line();

-	static struct channel *frame_prev,
-	                      *frame_next;
-
-	struct channel *c_first = channel_get_first(),
-	               *c_last = channel_get_last(),
-	               *tmp;
+	static struct channel *frame_prev;
+	static struct channel *frame_next;
+
+	struct channel *c_first = channel_get_first();
+	struct channel *c_last = channel_get_last();
+	struct channel *tmp;
+	struct channel *tmp_next = c;
+	struct channel *tmp_prev = c;

 	unsigned cols = state_cols();
-
-	c->activity = ACTIVITY_DEFAULT;

 	/* By default assume drawing starts towards the next channel */
 	int nextward = 1;

-	size_t len, total_len = 0;
+	size_t len;
+	size_t len_total = 0;
+
+	c->activity = ACTIVITY_DEFAULT;

 	/* Bump the channel frames, if applicable */
-	if ((total_len = (c->name_len + 2)) >= state_cols())
+	if ((len_total = (c->name_len + 2)) >= state_cols())
 		return;
 	else if (c == frame_prev && frame_prev != c_first)
 		frame_prev = channel_get_prev(frame_prev);
@@ -572,39 +575,26 @@
 		frame_next = channel_get_next(frame_next);

 	/* Calculate the new frames */
-	struct channel *tmp_prev = c, *tmp_next = c;
-
 	for (;;) {

 		if (tmp_prev == c_first || tmp_prev == frame_prev) {

-			/* Pad out nextward */
-
+			/* Pad from the next-most frame towards the last channel */
 			tmp = channel_get_next(tmp_next);
 			len = tmp->name_len;

-			while ((total_len += (len + 2)) < state_cols() && tmp != c_first) {
-
+			while ((len_total += (len + 2)) < state_cols() && tmp != c_first) {
 				tmp_next = tmp;
-
 				tmp = channel_get_next(tmp);
 				len = tmp->name_len;
 			}

-			break;
-		}
-
-		if (tmp_next == c_last || tmp_next == frame_next) {
-
-			/* Pad out prevward */
-
+			/* Pad from the prev-most frame towards the first channel */
 			tmp = channel_get_prev(tmp_prev);
 			len = tmp->name_len;

-			while ((total_len += (len + 2)) < state_cols() && tmp != c_last) {
-
+			while ((len_total += (len + 2)) < state_cols() && tmp != c_last) {
 				tmp_prev = tmp;
-
 				tmp = channel_get_prev(tmp);
 				len = tmp->name_len;
 			}
@@ -612,11 +602,36 @@
 			break;
 		}

+		if (tmp_next == c_last || tmp_next == frame_next) {
+
+			/* Pad from the prev-most frame towards the first channel */
+			tmp = channel_get_prev(tmp_prev);
+			len = tmp->name_len;
+
+			while ((len_total += (len + 2)) < state_cols() && tmp != c_last) {
+				tmp_prev = tmp;
+				tmp = channel_get_prev(tmp);
+				len = tmp->name_len;
+			}
+
+			/* Pad from the next-most frame towards the last channel */
+			tmp = channel_get_next(tmp_next);
+			len = tmp->name_len;
+
+			while ((len_total += (len + 2)) < state_cols() && tmp != c_first) {
+				tmp_next = tmp;
+				tmp = channel_get_next(tmp);
+				len = tmp->name_len;
+			}
+
+			break;
+		}
+
 		tmp = nextward ? channel_get_next(tmp_next) : channel_get_prev(tmp_prev);
 		len = tmp->name_len;

 		/* Next channel doesn't fit */
-		if ((total_len += (len + 2)) >= state_cols())
+		if ((len_total += (len + 2)) >= state_cols())
 			break;

 		if (nextward)


Switched to DenseMap for allowed sets in PBQP. Reduces total LLC time by 15% on CINT2006 for x86-32.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@132707 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/CodeGen/RegAllocPBQP.h
+++ include/llvm/CodeGen/RegAllocPBQP.h
@@ -94,7 +94,7 @@
     typedef std::map<PBQP::Graph::ConstNodeItr, unsigned,
                      PBQP::NodeItrComparator>  Node2VReg;
     typedef DenseMap<unsigned, PBQP::Graph::NodeItr> VReg2Node;
-    typedef std::map<unsigned, AllowedSet> AllowedSetMap;
+    typedef DenseMap<unsigned, AllowedSet> AllowedSetMap;

     PBQP::Graph graph;
     Node2VReg node2VReg;


minor, common case first

minor, common case first

Signed-off-by: Sebastian Freundt <1f0829204b3475c52f714f96be4e7b39a87b6e74@ga-group.nl>

--- src/dseq.c
+++ src/dseq.c
@@ -217,7 +217,8 @@
 static struct dt_d_s
 date_add(struct dt_d_s d, struct dt_dur_s dur[], size_t ndur)
 {
-	for (size_t i = 0; i < ndur; i++) {
+	d = dt_add(d, dur[0]);
+	for (size_t i = 1; i < ndur; i++) {
 		d = dt_add(d, dur[i]);
 	}
 	return d;


DebugInfo: Add MDTypeRefArray, to replace DITypeArray

This array-like wrapper adapts `MDTuple` to have elements of `MDTypeRef`
(whereas `MDTypeArray` has elements of `MDType`).  This is necessary to
migrate code using `DITypeArray`.  The only use of this is
`MDSubroutineType`'s `getTypeArray()` accessor.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@234200 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/IR/DebugInfoMetadata.h
+++ include/llvm/IR/DebugInfoMetadata.h
@@ -88,6 +88,42 @@
 typedef TypedDebugNodeRef<DebugNode> DebugNodeRef;
 typedef TypedDebugNodeRef<MDScope> MDScopeRef;
 typedef TypedDebugNodeRef<MDType> MDTypeRef;
+
+class MDTypeRefArray {
+  const MDTuple *N = nullptr;
+
+public:
+  MDTypeRefArray(const MDTuple *N) : N(N) {}
+  operator MDTuple *() const { return const_cast<MDTuple *>(N); }
+  MDTuple *operator->() const { return const_cast<MDTuple *>(N); }
+  MDTuple &operator*() const { return *const_cast<MDTuple *>(N); }
+
+  unsigned size() const { return N->getNumOperands(); }
+  MDTypeRef operator[](unsigned I) const { return MDTypeRef(N->getOperand(I)); }
+
+  class iterator : std::iterator<std::input_iterator_tag, MDTypeRef,
+                                 std::ptrdiff_t, void, MDTypeRef> {
+    MDNode::op_iterator I;
+
+  public:
+    explicit iterator(MDNode::op_iterator I) : I(I) {}
+    MDTypeRef operator*() const { return MDTypeRef(*I); }
+    iterator &operator++() {
+      ++I;
+      return *this;
+    }
+    iterator operator++(int) {
+      iterator Temp(*this);
+      ++I;
+      return Temp;
+    }
+    bool operator==(const iterator &X) const { return I == X.I; }
+    bool operator!=(const iterator &X) const { return I != X.I; }
+  };
+
+  iterator begin() const { return iterator(N->op_begin()); }
+  iterator end() const { return iterator(N->op_end()); }
+};

 /// \brief Tagged DWARF-like metadata node.
 ///
@@ -826,7 +862,7 @@

   TempMDSubroutineType clone() const { return cloneImpl(); }

-  MDTuple *getTypeArray() const { return getElements(); }
+  MDTypeRefArray getTypeArray() const { return getElements(); }
   Metadata *getRawTypeArray() const { return getRawElements(); }

   static bool classof(const Metadata *MD) {


fix, PEBKAC, actually check first argument for fix ups in dseq(1) with 1 or 2 inputs

--- src/dseq.c
+++ src/dseq.c
@@ -513,7 +513,7 @@
 			}
 			rc = 1;
 			goto out;
-		} else if (UNLIKELY(lst.fix) && !argi->quiet_flag) {
+		} else if (UNLIKELY(fst.fix) && !argi->quiet_flag) {
 			rc = 2;
 		}


Remove FIXMEs surrounding Constant[Data]Vectors, instead

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@169938 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Support/PatternMatch.h
+++ include/llvm/Support/PatternMatch.h
@@ -98,19 +98,13 @@
       Res = &CI->getValue();
       return true;
     }
-    // FIXME: Remove this.
-    if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
-      if (ConstantInt *CI =
-          dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
-        Res = &CI->getValue();
-        return true;
-      }
-    if (ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
-      if (ConstantInt *CI =
-          dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
-        Res = &CI->getValue();
-        return true;
-      }
+    if (V->getType()->isVectorTy())
+      if (const Constant *C = dyn_cast<Constant>(V))
+        if (ConstantInt *CI =
+            dyn_cast_or_null<ConstantInt>(C->getSplatValue())) {
+          Res = &CI->getValue();
+          return true;
+        }
     return false;
   }
 };
@@ -151,13 +145,11 @@
   bool match(ITy *V) {
     if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
       return this->isValue(CI->getValue());
-    // FIXME: Remove this.
-    if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
-      if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
-        return this->isValue(CI->getValue());
-    if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
-      if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
-        return this->isValue(CI->getValue());
+    if (V->getType()->isVectorTy())
+      if (const Constant *C = dyn_cast<Constant>(V))
+        if (const ConstantInt *CI =
+            dyn_cast_or_null<ConstantInt>(C->getSplatValue()))
+          return this->isValue(CI->getValue());
     return false;
   }
 };
@@ -175,21 +167,13 @@
         Res = &CI->getValue();
         return true;
       }
-
-    // FIXME: remove.
-    if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
-      if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
-        if (this->isValue(CI->getValue())) {
-          Res = &CI->getValue();
-          return true;
-        }
-
-    if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(V))
-      if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
-        if (this->isValue(CI->getValue())) {
-          Res = &CI->getValue();
-          return true;
-        }
+    if (V->getType()->isVectorTy())
+      if (const Constant *C = dyn_cast<Constant>(V))
+        if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(C->getSplatValue()))
+          if (this->isValue(CI->getValue())) {
+            Res = &CI->getValue();
+            return true;
+          }

     return false;
   }


canopen-dump: Display time in ISO 8601 format

--- src/dump.c
+++ src/dump.c
@@ -15,6 +15,7 @@

 #include <stdio.h>
 #include <unistd.h>
+#include <time.h>

 #include "socketcan.h"
 #include "canopen.h"
@@ -56,10 +57,17 @@

 static inline void print_ts(void)
 {
-	uint64_t t = current_time_;
-
-	if (options_ & CO_DUMP_TIMESTAMP)
-		printf("%llu.%06llu ", t / 1000000ULL, t % 1000000ULL);
+	if (!(options_ & CO_DUMP_TIMESTAMP))
+		return;
+
+	time_t seconds = current_time_ / 1000000ULL;
+	uint32_t microseconds = current_time_ % 1000000ULL;
+
+	struct tm tm = { 0 };
+	char buffer[256];
+
+	strftime(buffer, sizeof(buffer), "%FT%T", localtime_r(&seconds, &tm));
+	printf("%s.%06lluZ ", buffer, microseconds);
 }

 static inline struct node_state* get_node_state(int nodeid)


Connection management and debugging

Connection management and debugging

Prioritize clients
Limit parallel connection attempts
Fix statistics for “discover”
Optional event debugging

--- src/nrfmesh/nrfmesh.c
+++ src/nrfmesh/nrfmesh.c
@@ -44,6 +44,20 @@
 	.attr_handle = BLE_CONN_HANDLE_INVALID,
 };
 Mesh_Node mesh_node;
+
+//#define DEBUG_EVENTS  1
+
+#define MAX_CONCURRENT_CONNECTION_ATTEMPTS  1
+
+#if defined(DEBUG_EVENTS)
+
+#define DEBUG_EVENT_MAX   256
+struct debug_event
+{
+  uint8_t   evt_id;
+} debug_events[DEBUG_EVENT_MAX];
+
+#endif

 void nrfmesh_init(void)
 {
@@ -158,6 +172,21 @@
 	};

 	uint32_t err_code;
+
+#if defined(DEBUG_EVENTS)
+	{
+    switch (event->header.evt_id)
+    {
+    case BLE_GAP_EVT_RSSI_CHANGED:
+      break;
+
+    default:
+      memmove(debug_events + 1, debug_events, sizeof(struct debug_event) * (DEBUG_EVENT_MAX - 1));
+      debug_events[0].evt_id = event->header.evt_id;
+      break;
+    }
+	}
+#endif

 	secure_ble_event(event);

@@ -280,6 +309,8 @@
 					if (chr->uuid.type == UUIDS_BASE_TYPE && chr->uuid.uuid == MESH_SYNC_UUID)
 					{
 						mesh_node.sync.neighbor->handle = chr->handle_value;
+						STAT_RECORD_INC(discover_success_count);
+		        STAT_TIMER_END(discover_total_time_ms);
 						goto connected;
 					}
 				}
@@ -421,17 +452,29 @@
 		  STAT_RECORD_INC(connection_timeout_count);
 		  // Flag each neighbor we failed to connect to
 		  uint8_t addr_count = 0;
-		  for (Mesh_Neighbor* neighbor = &mesh_node.neighbors.neighbors[0]; neighbor < &mesh_node.neighbors.neighbors[MESH_MAX_NEIGHBORS] && addr_count < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; neighbor++)
+		  uint8_t total_count = 0;
+		  Mesh_ChangeBits remainingbits = mesh_node.sync.remainingbits;
+		  for (Mesh_Neighbor* neighbor = &mesh_node.neighbors.neighbors[0]; neighbor < &mesh_node.neighbors.neighbors[MESH_MAX_NEIGHBORS]; neighbor++)
 		  {
-			  if (neighbor->flag.valid && !neighbor->flag.retry && (mesh_node.sync.remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(&mesh_node, neighbor)))
-			  {
-			    neighbor->flag.retry = 1;
-			    neighbor->retries++;
-			    if (!mesh_node.ids[neighbor->id].flag.client)
-			    {
-			      addr_count++;
-			    }
-			  }
+		    if (neighbor->flag.valid && mesh_node.ids[neighbor->id].flag.client && !neighbor->flag.retry && (remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(&mesh_node, neighbor)))
+		    {
+		      neighbor->flag.retry = 1;
+		      neighbor->retries++;
+		      total_count++;
+		    }
+		  }
+		  if (total_count == 0)
+		  {
+		    for (Mesh_Neighbor* neighbor = &mesh_node.neighbors.neighbors[0]; total_count < MAX_CONCURRENT_CONNECTION_ATTEMPTS && neighbor < &mesh_node.neighbors.neighbors[MESH_MAX_NEIGHBORS] && addr_count < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; neighbor++)
+		    {
+		      if (neighbor->flag.valid && !mesh_node.ids[neighbor->id].flag.client && !neighbor->flag.retry && (remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(&mesh_node, neighbor)))
+		      {
+		        neighbor->flag.retry = 1;
+            neighbor->retries++;
+            total_count++;
+            addr_count++;
+		      }
+		    }
 		  }
 		  Mesh_Process(&mesh_node, MESH_EVENT_CONNECTIONFAILED, 0, 0);
 		  break;
@@ -515,34 +558,40 @@
   ble_gap_irk_t* p_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
   uint8_t addr_count = 0;
   uint8_t irk_count = 0;
-
+  uint8_t total_count = 0;
+
+  // Prioritize clients
+  Mesh_ChangeBits remainingbits = node->sync.remainingbits;
   for (Mesh_Neighbor* neighbor = &node->neighbors.neighbors[0]; neighbor < &node->neighbors.neighbors[MESH_MAX_NEIGHBORS] && addr_count < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; neighbor++)
   {
-    if (neighbor->flag.valid && !neighbor->flag.retry && (mesh_node.sync.remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(node, neighbor)))
+    if (neighbor->flag.valid && node->ids[neighbor->id].flag.client && !neighbor->flag.retry && (remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(node, neighbor)))
     {
-      if (!mesh_node.ids[neighbor->id].flag.client)
+      irk_count = secure_get_irks(irks);
+      for (uint8_t i = irk_count; i--; )
+      {
+        p_irks[i] = &irks[i];
+      }
+      total_count += irk_count;
+      break;
+    }
+  }
+  if (total_count == 0)
+  {
+    for (Mesh_Neighbor* neighbor = &node->neighbors.neighbors[0]; total_count < MAX_CONCURRENT_CONNECTION_ATTEMPTS && neighbor < &node->neighbors.neighbors[MESH_MAX_NEIGHBORS] && addr_count < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; neighbor++)
+    {
+      if (neighbor->flag.valid && !node->ids[neighbor->id].flag.client && !neighbor->flag.retry && (remainingbits & MESH_NEIGHBOR_TO_CHANGEBIT(node, neighbor)))
       {
         addrs[addr_count].addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
-        Mesh_System_memmove(&addrs[addr_count].addr, &mesh_node.ids[neighbor->id].address, sizeof(Mesh_NodeAddress));
+        Mesh_System_memmove(&addrs[addr_count].addr, &node->ids[neighbor->id].address, sizeof(Mesh_NodeAddress));
         p_addrs[addr_count] = &addrs[addr_count];
         addr_count++;
-      }
-      else
-      {
-        if (irk_count == 0)
-        {
-          irk_count = secure_get_irks(irks);
-          for (uint8_t i = irk_count; i--; )
-          {
-            p_irks[i] = &irks[i];
-          }
-        }
+        total_count++;
       }
     }
   }

   // If we have nothing to do, return now
-  if (irk_count == 0 && addr_count == 0)
+  if (total_count == 0)
   {
     return MESH_NOTFOUND;
   }


the 7.1 fix breaks on 7.0

the 7.1 fix breaks on 7.0

so now I have giant ifdefs all over

--- src/enum.c
+++ src/enum.c
@@ -242,6 +242,25 @@
 }
 /* }}} */

+#if PHP_VERSION_ID < 70100
+/* {{{ helper for construct to gather up constants */
+static int eos_datastructures_enum_collect_constants(zval *constant_value, int num_args, va_list args, zend_hash_key *hash_key)
+{
+	HashTable *elements = va_arg(args, HashTable*);
+	zend_string *classname = va_arg(args, zend_string*);
+
+	if(Z_TYPE_P(constant_value) != IS_LONG) {
+		php_error(E_WARNING, "Constant %s is being cast to an integer in Enum subclass %s", hash_key->key->val, classname->val);
+		convert_to_long(constant_value);
+	}
+
+	zend_hash_add(elements, hash_key->key, constant_value);
+
+	return ZEND_HASH_APPLY_KEEP;
+}
+/* }}} */
+#endif
+
 /* {{{ */
 static zend_object* eos_datastructures_enum_create_object(zend_class_entry *ce)
 {
@@ -251,6 +270,7 @@
 	ALLOC_HASHTABLE(intern->elements);
 	zend_hash_init(intern->elements, 8, NULL, NULL, 0);

+#if PHP_VERSION_ID >= 70100
 	int count = zend_hash_num_elements(&ce->constants_table);
 	if (count > 0) {
 		zend_string *key;
@@ -265,6 +285,9 @@
 			zend_hash_add(intern->elements, key, value);
 		} ZEND_HASH_FOREACH_END();
 	}
+#else
+	zend_hash_apply_with_arguments(&ce->constants_table, (apply_func_args_t)eos_datastructures_enum_collect_constants, 2, intern->elements, ce->name);
+#endif

 	object_properties_init(&(intern->std), ce);
 	return return_value;


Python: removed wrong PyErr_Print() call.

PyCallable_Check() doesn't produce errors.

The needless call was introduced in fdd6ed28e3b9.

--- src/nxt_python_wsgi.c
+++ src/nxt_python_wsgi.c
@@ -322,7 +322,6 @@
     if (nxt_slow_path(PyCallable_Check(obj) == 0)) {
         nxt_alert(task, "\"application\" in module \"%s\" "
                   "is not a callable object", nxt_py_module);
-        PyErr_Print();
         goto fail;
     }


pack refractor

pack refractor

error: pathspec 'include/utils/blitz_impl_function.h' did not match any file(s) known to git

--- include/utils/blitz_impl_function.h
+++ include/utils/blitz_impl_function.h
@@ -0,0 +1,69 @@
+#ifndef INCLUDE_UTIL_BLITZ_IMPL_FUNCTION_H_
+#define INCLUDE_UTIL_BLITZ_IMPL_FUNCTION_H_
+
+namespace blitz {
+
+template<template <typename> class TensorType, typename DType, typename DataLayout>
+void PackImpl(
+  const DType* I,
+  DType* unpack,
+  size_t C, size_t H, size_t W,
+  size_t R, size_t S,
+  size_t P, size_t Q,
+  size_t pad_h, size_t pad_w,
+  size_t str_h, size_t str_w);
+
+template<template <typename> class TensorType, typename DType, typename DataLayout>
+void UnpackCHWImpl(
+  const DType* I,
+  DType* unpack,
+  size_t C, size_t H, size_t W,
+  size_t R, size_t S,
+  size_t P, size_t Q,
+  size_t pad_h, size_t pad_w,
+  size_t str_h, size_t str_w);
+
+template<template <typename> class TensorType, typename DType, typename DataLayout>
+void MaxPoolingForwardImpl(
+  const DType* I,
+  DType* O,
+  size_t* max_index,
+  size_t N,
+  size_t C, size_t H, size_t W,
+  size_t K, size_t P, size_t Q,
+  size_t R, size_t S,
+  size_t str_h, size_t str_w);
+
+template<template <typename> class TensorType, typename DType, typename DataLayout>
+void MaxPoolingBackwardImpl(
+  const DType* O,
+  DType* I,
+  const size_t* max_index,
+  size_t N,
+  size_t C, size_t H, size_t W,
+  size_t K, size_t P, size_t Q);
+
+template<template <typename> class TensorType, typename DType, typename InputDataLayout, typename OutputDataLayout>
+void Convolution2DForwardGEMMDispatch(
+  DType* unpack,
+  DType* O,
+  DType* F,
+  size_t K, size_t PQ, size_t CRS);
+
+template<template <typename> class TensorType, typename DType, typename InputDataLayout, typename OutputDataLayout>
+void Convolution2DBackwardGEMMDispatch(
+  DType* F,
+  DType* O,
+  DType* unpack,
+  size_t K, size_t PQ, size_t CRS);
+
+template<template <typename> class TensorType, typename DType, typename InputDataLayout, typename OutputDataLayout>
+void Convolution2DUpdateGEMMDispatch(
+  DType* unpack,
+  DType* O,
+  DType* update,
+  size_t K, size_t CRS, size_t PQ);
+
+}  // namespace blitz
+
+#endif  // INCLUDE_UTIL_BLITZ_IMPL_FUNCTION_H_


format multivector.h

format multivector.h

--- include/versor/detail/multivector.h
+++ include/versor/detail/multivector.h
@@ -32,8 +32,8 @@

 #include <versor/detail/algebra.h>

+#include <math.h>
 #include <iostream>
-#include <math.h>

 namespace vsr {

@@ -44,7 +44,8 @@
 // data is combined with other methods is determined by their respective basis,
 // in coordination with the algebra.

-template <typename algebra_type, typename basis_type> struct Multivector {
+template <typename algebra_type, typename basis_type>
+struct Multivector {
   // Algebra (a metric and a field)
   using algebra = algebra_type;

@@ -62,7 +63,8 @@
   using space = typename algebra::types;

   // another type within same algebra
-  template <class B> using MultivectorB = Multivector<algebra, B>;
+  template <class B>
+  using MultivectorB = Multivector<algebra, B>;

   // the dual type (product of this and algebra::types::pseudoscalar)
   using Dual = typename algebra::template make_gp<
@@ -103,11 +105,14 @@
       : Multivector(b.template cast<Multivector<algebra, basis>>()) {}

   // immutable get value of blade type IDX
-  template <bits::type IDX> value_t get() const;
+  template <bits::type IDX>
+  value_t get() const;
   // mutable get value of blade type IDX
-  template <bits::type IDX> value_t &get();
+  template <bits::type IDX>
+  value_t &get();
   // set value of blade type IDX
-  template <bits::type IDX> Multivector &set(value_t v);
+  template <bits::type IDX>
+  Multivector &set(value_t v);

   /// Reset
   Multivector &reset(value_t v = value_t()) {
@@ -125,15 +130,16 @@
   Multivector inv() const { return involution(); }

   /// Casting to type B
-  template <class B> B cast() const;
+  template <class B>
+  B cast() const;
   /// Copying to type B
-  template <class B> B copy() const;
+  template <class B>
+  B copy() const;

   // comparison
   bool operator==(const Multivector &mv) const {
     for (int i = 0; i < Num; ++i) {
-      if (val[i] != mv[i])
-        return false;
+      if (val[i] != mv[i]) return false;
     }
     return true;
   }
@@ -145,44 +151,53 @@
   }

   // geometric product
-  template <class B> auto operator*(const MultivectorB<B> &b) const {
+  template <class B>
+  auto operator*(const MultivectorB<B> &b) const {
     return algebra::gp(*this, b);
   }

   // geometric product in place Transformation
-  template <class B> Multivector &operator*=(const MultivectorB<B> &b) {
+  template <class B>
+  Multivector &operator*=(const MultivectorB<B> &b) {
     *this = *this * b;
     return *this;
   }

   // outer product
-  template <class B> auto operator^(const MultivectorB<B> &b) const {
+  template <class B>
+  auto operator^(const MultivectorB<B> &b) const {
     return algebra::op(*this, b);
   }

   // left contraction inner product
-  template <class B> auto operator<=(const MultivectorB<B> &b) const {
+  template <class B>
+  auto operator<=(const MultivectorB<B> &b) const {
     return algebra::ip(*this, b);
   }

   // commutator product
-  template <class B> auto operator%(const MultivectorB<B> &b) const {
+  template <class B>
+  auto operator%(const MultivectorB<B> &b) const {
     return ((*this * b) - (b * (*this))) * .5;
   }

   // rotor (even) transformation
-  template <typename B> Multivector spin(const MultivectorB<B> &b) const {
+  template <typename B>
+  Multivector spin(const MultivectorB<B> &b) const {
     return algebra::spin(*this, b);
   }
   // versor (odd) transformation
-  template <typename B> Multivector reflect(const MultivectorB<B> &b) const {
+  template <typename B>
+  Multivector reflect(const MultivectorB<B> &b) const {
     return algebra::reflect(*this, b);
   }

-  template <typename B> Multivector sp(const MultivectorB<B> &b) const {
+  template <typename B>
+  Multivector sp(const MultivectorB<B> &b) const {
     return spin(b);
   }
-  template <typename B> Multivector re(const MultivectorB<B> &b) const {
+  template <typename B>
+  Multivector re(const MultivectorB<B> &b) const {
     return reflect(b);
   }

@@ -199,7 +214,8 @@
   }

   // division
-  template <class B> auto operator/(const MultivectorB<B> &b) const {
+  template <class B>
+  auto operator/(const MultivectorB<B> &b) const {
     return (*this * !b);
   }

@@ -211,27 +227,42 @@
   Multivector<algebra, typename algebra::vector_basis> null() const;

   // rotate in b plane
-  template <class B> Multivector rot(const MultivectorB<B> &b) const;
-  template <class B> Multivector rotate(const MultivectorB<B> &b) const;
-
-  template <class B> Multivector trs(const MultivectorB<B> &b) const;
-  template <class B> Multivector translate(const MultivectorB<B> &b) const;
-
-  template <class... Ts> Multivector trs(Ts... v) const;
-  template <class... Ts> Multivector translate(Ts... v) const;
-
-  template <class B> Multivector trv(const MultivectorB<B> &b) const;
-  template <class B> Multivector transverse(const MultivectorB<B> &b) const;
-
-  template <class... Ts> Multivector trv(Ts... v) const;
-  template <class... Ts> Multivector transverse(Ts... v) const;
-
-  template <class B> Multivector mot(const MultivectorB<B> &b) const;
-  template <class B> Multivector motor(const MultivectorB<B> &b) const;
-  template <class B> Multivector twist(const MultivectorB<B> &b) const;
-
-  template <class B> Multivector bst(const MultivectorB<B> &b) const;
-  template <class B> Multivector boost(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector rot(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector rotate(const MultivectorB<B> &b) const;
+
+  template <class B>
+  Multivector trs(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector translate(const MultivectorB<B> &b) const;
+
+  template <class... Ts>
+  Multivector trs(Ts... v) const;
+  template <class... Ts>
+  Multivector translate(Ts... v) const;
+
+  template <class B>
+  Multivector trv(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector transverse(const MultivectorB<B> &b) const;
+
+  template <class... Ts>
+  Multivector trv(Ts... v) const;
+  template <class... Ts>
+  Multivector transverse(Ts... v) const;
+
+  template <class B>
+  Multivector mot(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector motor(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector twist(const MultivectorB<B> &b) const;
+
+  template <class B>
+  Multivector bst(const MultivectorB<B> &b) const;
+  template <class B>
+  Multivector boost(const MultivectorB<B> &b) const;

   template <class B>
   Multivector dil(const MultivectorB<B> &b, VSR_PRECISION t) const;
@@ -249,29 +280,25 @@
   value_t rwt() const { return (*this <= ~(*this))[0]; }
   value_t norm() const {
     value_t a = rwt();
-    if (a < 0)
-      return 0;
+    if (a < 0) return 0;
     return sqrt(a);
   }

   value_t rnorm() const {
     value_t a = rwt();
-    if (a < 0)
-      return -sqrt(-a);
+    if (a < 0) return -sqrt(-a);
     return sqrt(a);
   }

   Multivector unit() const {
     value_t t = sqrt(fabs((*this <= *this)[0]));
-    if (t == 0)
-      return Multivector();
+    if (t == 0) return Multivector();
     return *this / t;
   }

   Multivector runit() const {
     value_t t = rnorm();
-    if (t == 0)
-      return Multivector();
+    if (t == 0) return Multivector();
     return *this / t;
   }

@@ -293,15 +320,13 @@

   Multivector operator+(const Multivector &a) const {
     Multivector tmp;
-    for (int i = 0; i < Num; ++i)
-      tmp[i] = (*this)[i] + a[i];
+    for (int i = 0; i < Num; ++i) tmp[i] = (*this)[i] + a[i];
     return tmp;
   }

   Multivector operator-(const Multivector &a) const {
     Multivector tmp;
-    for (int i = 0; i < Num; ++i)
-      tmp[i] = (*this)[i] - a[i];
+    for (int i = 0; i < Num; ++i) tmp[i] = (*this)[i] - a[i];
     return tmp;
   }

@@ -314,13 +339,11 @@
   }

   Multivector &operator-=(const Multivector &b) {
-    for (int i = 0; i < Num; ++i)
-      (*this)[i] -= b[i];
+    for (int i = 0; i < Num; ++i) (*this)[i] -= b[i];
     return *this;
   }
   Multivector &operator+=(const Multivector &b) {
-    for (int i = 0; i < Num; ++i)
-      (*this)[i] += b[i];
+    for (int i = 0; i < Num; ++i) (*this)[i] += b[i];
     return *this;
   }

@@ -369,7 +392,7 @@

   friend ostream &operator<<(ostream &os, const Multivector &m) {
     for (int i = 0; i < Num; ++i) {
-      os << m[i] << " "; // std::endl;
+      os << m[i] << " ";  // std::endl;
     }
     return os;
   }
@@ -387,8 +410,7 @@
 template <class A>
 A Multivector<Algebra, B>::copy() const {
   A tmp;
-  for (int i = 0; i < A::basis::Num; ++i)
-    tmp[i] = (*this)[i];
+  for (int i = 0; i < A::basis::Num; ++i) tmp[i] = (*this)[i];
   return tmp;
 }

@@ -406,35 +428,35 @@
 }
 template <typename Algebra, typename B>
 template <bits::type IDX>
-Multivector<Algebra, B> &
-Multivector<Algebra, B>::set(typename Algebra::value_t v) {
+Multivector<Algebra, B> &Multivector<Algebra, B>::set(
+    typename Algebra::value_t v) {
   get<IDX>() = v;
   return *this;
 }

 template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::x = Multivector<Algebra, B>().template set<1>(1);
-
-template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::y = Multivector<Algebra, B>().template set<2>(1);
-
-template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::z = Multivector<Algebra, B>().template set<4>(1);
-
-template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::xy = Multivector<Algebra, B>().template set<3>(1);
-
-template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::xz = Multivector<Algebra, B>().template set<5>(1);
-
-template <typename Algebra, typename B>
-Multivector<Algebra, B>
-    Multivector<Algebra, B>::yz = Multivector<Algebra, B>().template set<6>(1);
+Multivector<Algebra, B> Multivector<Algebra, B>::x =
+    Multivector<Algebra, B>().template set<1>(1);
+
+template <typename Algebra, typename B>
+Multivector<Algebra, B> Multivector<Algebra, B>::y =
+    Multivector<Algebra, B>().template set<2>(1);
+
+template <typename Algebra, typename B>
+Multivector<Algebra, B> Multivector<Algebra, B>::z =
+    Multivector<Algebra, B>().template set<4>(1);
+
+template <typename Algebra, typename B>
+Multivector<Algebra, B> Multivector<Algebra, B>::xy =
+    Multivector<Algebra, B>().template set<3>(1);
+
+template <typename Algebra, typename B>
+Multivector<Algebra, B> Multivector<Algebra, B>::xz =
+    Multivector<Algebra, B>().template set<5>(1);
+
+template <typename Algebra, typename B>
+Multivector<Algebra, B> Multivector<Algebra, B>::yz =
+    Multivector<Algebra, B>().template set<6>(1);

 // unary operations

@@ -514,7 +536,8 @@
 template <typename algebra>
 using GAEucPss = Multivector<algebra, typename algebra::types::eucpss>;

-template <typename algebra> struct GAE {
+template <typename algebra>
+struct GAE {
   template <bits::type... NN>
   using e = typename algebra::types::template e<NN...>;
 };
@@ -546,7 +569,8 @@
 template <bits::type dim, typename T = VSR_PRECISION>
 using euclidean_rotor = GARot<euclidean<dim, T>>;

-template <typename T = VSR_PRECISION> struct NE {
+template <typename T = VSR_PRECISION>
+struct NE {
   template <bits::type... NN>
   using e = typename GAE<euclidean<bits::dimOf(bits::BladeMaker<NN...>::type),
                                    T>>::template e<NN...>;
@@ -619,4 +643,4 @@
 template <bits::type N, typename T = VSR_PRECISION>
 using NCon = GACon<conformal<N, T>>;

-} // namespace vsr+}  // namespace vsr


strm may be NULL in lambda_call()

strm may be NULL in lambda_call()

--- src/exec.c
+++ src/exec.c
@@ -314,8 +314,10 @@
   c.prev = lambda->state;
   if ((args == NULL && argc != 0) || (args->len != argc)) {
     strm_raise(strm, "wrong number of arguments");
-    strm->exc->fname = nlbd->fname;
-    strm->exc->lineno = nlbd->lineno;
+    if (strm) {
+      strm->exc->fname = nlbd->fname;
+      strm->exc->lineno = nlbd->lineno;
+    }
     return STRM_NG;
   }
   for (i=0; i<argc; i++) {


use LU decomposition to solve matrix equation, not invert

--- src/expm.c
+++ src/expm.c
@@ -1,7 +1,7 @@
 /**
  * @file   expm.c
  * @author Michael Hartmann <michael.hartmann@physik.uni-augsburg.de>
- * @date   September, 2015
+ * @date   November, 2015
  * @brief  implement matrix exponential function
  */

@@ -107,21 +107,24 @@
         A2n = NULL;
     }

-    /* U = V+U, V = V-U */
+    /* A = V+U, V = V-U */
     for(int i = 0; i < dim; i++)
         for(int j = 0; j < dim; j++)
         {
             const complex_t Uij = matrix_get(U,i,j);
             const complex_t Vij = matrix_get(V,i,j);

-            matrix_set(U, i,j, Vij+Uij);
+            matrix_set(A, i,j, Vij+Uij);
             matrix_set(V, i,j, Vij-Uij);
         }

+    /* free matrix U */
+    matrix_complex_free(U);
+    U = NULL;
+
     /* A = (V-U)^-1 * (V+U) */
-    ret = matrix_complex_invert(V); /* XXX solve linear system, not inv!!! */
+    ret = matrix_complex_solve(V,A);
     return_error(ret != 0, ret);
-    matrix_complex_mult(V,U,1,A);

 out:
     if(U != NULL)
@@ -247,24 +250,24 @@
     matrix_complex_free(A6);
     A2 = A4 = A6 = NULL;

-    /* U = V+U, V = V-U */
+    /* A = V+U, V = V-U */
     for(int i = 0; i < dim; i++)
         for(int j = 0; j < dim; j++)
         {
             const complex_t Uij = matrix_get(U,i,j);
             const complex_t Vij = matrix_get(V,i,j);

-            matrix_set(U, i,j, Vij+Uij);
+            matrix_set(A, i,j, Vij+Uij);
             matrix_set(V, i,j, Vij-Uij);
         }

-    /* X = (V-U)^-1 * (V+U) */
-    ret = matrix_complex_invert(V); /* XXX solve linear system, not inv!!! */
-    return_error(ret != 0, ret);
-
-    matrix_complex_mult(V,U,1,A);
+    /* free matrix U */
     matrix_complex_free(U);
     U = NULL;
+
+    /* X = (V-U)^-1 * (V+U) */
+    ret = matrix_complex_solve(V,A);
+    return_error(ret != 0, ret);

     /* square */
     _expm_square(A, V, s);


missing ;

missing ;

--- src/feat.h
+++ src/feat.h
@@ -71,8 +71,8 @@

     double MaxDec;
     double MinDec;
-    double MaxRa'
-    double MinRa
+    double MaxRa;'
+    double MinRa;
 	// Indirectly set by features file
 	int Categories;
 	Slist types; // Same as type but with only QSO LRG ELG SS SF


Fix newly introduced incorrect WDT feeding.

--- app/modules/hx711.c
+++ app/modules/hx711.c
@@ -36,7 +36,7 @@
   //wait for data ready.  or time out.
   //TODO: set pin inturrupt and come back to it.  This may take up to 1/10 sec
   //        or maybe just make an async version too and have both available.
-	WRITE_PERI_REG(0x60000914, 0x73); //clear WDT... this may take a while.
+	system_soft_wdt_feed(); //clear WDT... this may take a while.
   for (i = 0; i<HX711_MAX_WAIT && platform_gpio_read(data_pin)==1;i++){
     asm ("nop");
   }


fix segfault when logging is on for file open errors

--- src/file.c
+++ src/file.c
@@ -64,13 +64,13 @@

     if (f->audio_stream_index < 0) {
         groove_file_close(file);
-        av_log(NULL, AV_LOG_ERROR, "%s: no audio stream found\n", f->ic->filename);
+        av_log(NULL, AV_LOG_ERROR, "%s: no audio stream found\n", filename);
         return NULL;
     }

     if (!f->decoder) {
         groove_file_close(file);
-        av_log(NULL, AV_LOG_ERROR, "%s: no decoder found\n", f->ic->filename);
+        av_log(NULL, AV_LOG_ERROR, "%s: no decoder found\n", filename);
         return NULL;
     }


remove unused malloc.h include (fix FreeBSD build)

--- src/fiob.c
+++ src/fiob.c
@@ -11,7 +11,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <malloc.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <say.h>


Modify compression methods to allow jpeg images

--- src/omv/py/py_image.c
+++ src/omv/py/py_image.c
@@ -1339,8 +1339,46 @@
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rainbow_obj, 1, py_image_to_rainbow);

+static mp_obj_t py_image_jpeg_encode_for_ide(mp_obj_t img_obj)
+{
+    image_t *arg_img = py_image_cobj(img_obj);
+    PY_ASSERT_TRUE_MSG(arg_img->bpp >= IMAGE_BPP_JPEG, "Image format is not supported!");
+    PY_ASSERT_TRUE_MSG(MAIN_FB()->pixels == arg_img->data, "Can't compress in place!");
+
+    int new_size = fb_encode_for_ide_new_size(arg_img);
+    fb_alloc_mark();
+    uint8_t *temp = fb_alloc(new_size, FB_ALLOC_NO_HINT);
+    fb_encode_for_ide(temp, arg_img);
+
+    MAIN_FB()->bpp = 0;
+    PY_ASSERT_TRUE_MSG(new_size <= fb_avail(), "The new image won't fit in the main frame buffer!");
+    MAIN_FB()->bpp = new_size;
+    arg_img->bpp = new_size;
+
+    memcpy(arg_img->data, temp, new_size);
+    fb_alloc_free_till_mark();
+
+    return img_obj;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_jpeg_encode_for_ide_obj, py_image_jpeg_encode_for_ide);
+
+static mp_obj_t py_image_jpeg_encoded_for_ide(mp_obj_t img_obj)
+{
+    image_t *arg_img = py_image_cobj(img_obj);
+    PY_ASSERT_TRUE_MSG(arg_img->bpp >= IMAGE_BPP_JPEG, "Image format is not supported!");
+
+    int new_size = fb_encode_for_ide_new_size(arg_img);
+    uint8_t *temp = xalloc(new_size);
+    fb_encode_for_ide(temp, arg_img);
+
+    return py_image(arg_img->w, arg_img->h, new_size, temp);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_jpeg_encoded_for_ide_obj, py_image_jpeg_encoded_for_ide);
+
 static mp_obj_t py_image_compress(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
 {
+    if (IM_IS_JPEG((image_t *) py_image_cobj(args[0]))) return args[0];
+
     image_t *arg_img = py_helper_arg_to_image_mutable_bayer(args[0]);
     int arg_q = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_quality), 50);
     PY_ASSERT_TRUE_MSG((1 <= arg_q) && (arg_q <= 100), "Error: 1 <= quality <= 100!");
@@ -1365,6 +1403,8 @@

 static mp_obj_t py_image_compress_for_ide(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
 {
+    if (IM_IS_JPEG((image_t *) py_image_cobj(args[0]))) return py_image_jpeg_encode_for_ide(args[0]);
+
     image_t *arg_img = py_helper_arg_to_image_mutable_bayer(args[0]);
     int arg_q = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_quality), 50);
     PY_ASSERT_TRUE_MSG((1 <= arg_q) && (arg_q <= 100), "Error: 1 <= quality <= 100!");
@@ -1392,7 +1432,15 @@

 static mp_obj_t py_image_compressed(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
 {
-    image_t *arg_img = py_helper_arg_to_image_mutable_bayer(args[0]);
+    image_t *arg_img = py_image_cobj(args[0]);
+
+    if (IM_IS_JPEG(arg_img)) {
+        image_t out = { .w=arg_img->w, .h=arg_img->h, .bpp=arg_img->bpp, .data=xalloc(arg_img->bpp) };
+        memcpy(out.data, arg_img->data, arg_img->bpp);
+        return py_image_from_struct(&out);
+    }
+
+    arg_img = py_helper_arg_to_image_mutable_bayer(args[0]);
     int arg_q = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_quality), 50);
     PY_ASSERT_TRUE_MSG((1 <= arg_q) && (arg_q <= 100), "Error: 1 <= quality <= 100!");

@@ -1412,6 +1460,8 @@

 static mp_obj_t py_image_compressed_for_ide(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
 {
+    if (IM_IS_JPEG((image_t *) py_image_cobj(args[0]))) return py_image_jpeg_encoded_for_ide(args[0]);
+
     image_t *arg_img = py_helper_arg_to_image_mutable_bayer(args[0]);
     int arg_q = py_helper_keyword_int(n_args, args, 1, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_quality), 50);
     PY_ASSERT_TRUE_MSG((1 <= arg_q) && (arg_q <= 100), "Error: 1 <= quality <= 100!");
@@ -1432,42 +1482,6 @@
     return py_image_from_struct(&out);
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_compressed_for_ide_obj, 1, py_image_compressed_for_ide);
-
-static mp_obj_t py_image_jpeg_encode_for_ide(mp_obj_t img_obj)
-{
-    image_t *arg_img = py_image_cobj(img_obj);
-    PY_ASSERT_TRUE_MSG(arg_img->bpp >= IMAGE_BPP_JPEG, "Image format is not supported!");
-    PY_ASSERT_TRUE_MSG(MAIN_FB()->pixels == arg_img->data, "Can't compress in place!");
-
-    int new_size = fb_encode_for_ide_new_size(arg_img);
-    fb_alloc_mark();
-    uint8_t *temp = fb_alloc(new_size, FB_ALLOC_NO_HINT);
-    fb_encode_for_ide(temp, arg_img);
-
-    MAIN_FB()->bpp = 0;
-    PY_ASSERT_TRUE_MSG(new_size <= fb_avail(), "The new image won't fit in the main frame buffer!");
-    MAIN_FB()->bpp = new_size;
-    arg_img->bpp = new_size;
-
-    memcpy(arg_img->data, temp, new_size);
-    fb_alloc_free_till_mark();
-
-    return img_obj;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_jpeg_encode_for_ide_obj, py_image_jpeg_encode_for_ide);
-
-static mp_obj_t py_image_jpeg_encoded_for_ide(mp_obj_t img_obj)
-{
-    image_t *arg_img = py_image_cobj(img_obj);
-    PY_ASSERT_TRUE_MSG(arg_img->bpp >= IMAGE_BPP_JPEG, "Image format is not supported!");
-
-    int new_size = fb_encode_for_ide_new_size(arg_img);
-    uint8_t *temp = xalloc(new_size);
-    fb_encode_for_ide(temp, arg_img);
-
-    return py_image(arg_img->w, arg_img->h, new_size, temp);
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_jpeg_encoded_for_ide_obj, py_image_jpeg_encoded_for_ide);

 static mp_obj_t py_image_copy_int(uint n_args, const mp_obj_t *args, mp_map_t *kw_args, bool mode)
 {


dont call Python to do TCP_NODELAY

dont call Python to do TCP_NODELAY

--- src/japronto/protocol/cprotocol.c
+++ src/japronto/protocol/cprotocol.c
@@ -15,9 +15,6 @@
 static PyObject* RouteNotFoundException;

 static PyObject* socket_str;
-static PyObject* one;
-static PyObject* IPPROTO_TCP;
-static PyObject* TCP_NODELAY;

 static Request_CAPI* request_capi;
 static Matcher_CAPI* matcher_capi;
@@ -168,6 +165,19 @@
 }

+// copied from Modules/socketmodule.h
+// FIXME on Windows SOCKET_T is a different type
+typedef int SOCKET_T;
+typedef struct {
+    PyObject_HEAD
+    SOCKET_T sock_fd;
+    // more things here that we dont need
+} PySocketSockObject;
+
+
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
 static PyObject*
 Protocol_connection_made(Protocol* self, PyObject* transport)
 {
@@ -180,8 +190,7 @@
 #endif

   PyObject* get_extra_info = NULL;
-  PyObject* socket = NULL;
-  PyObject* setsockopt = NULL;
+  PySocketSockObject* socket = NULL;
   PyObject* connections = NULL;
   self->transport = transport;
   Py_INCREF(self->transport);
@@ -189,16 +198,14 @@
   if(!(get_extra_info = PyObject_GetAttrString(transport, "get_extra_info")))
     goto error;

-  if(!(socket = PyObject_CallFunctionObjArgs(get_extra_info, socket_str, NULL)))
-    goto error;
-
-  if(!(setsockopt = PyObject_GetAttrString(socket, "setsockopt")))
-    goto error;
-
-  PyObject* tmp;
-  if(!(tmp = PyObject_CallFunctionObjArgs(setsockopt, IPPROTO_TCP, TCP_NODELAY, one, NULL)))
-    goto error;
-  Py_DECREF(tmp);
+  if(!(socket = (PySocketSockObject*)PyObject_CallFunctionObjArgs(
+       get_extra_info, socket_str, NULL)))
+    goto error;
+
+  const int on = 1;
+
+  if(setsockopt(socket->sock_fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0)
+    goto error;

   if(!(self->write = PyObject_GetAttrString(transport, "write")))
     goto error;
@@ -227,7 +234,6 @@

   finally:
   Py_XDECREF(connections);
-  Py_XDECREF(setsockopt);
   Py_XDECREF(socket);
   Py_XDECREF(get_extra_info);
   Py_RETURN_NONE;
@@ -906,12 +912,8 @@
 #endif
   PyObject* api_capsule = NULL;
   PyObject* crequest = NULL;
-  PyObject* socket = NULL;
   PyObject* route = NULL;
   socket_str = NULL;
-  one = NULL;
-  IPPROTO_TCP = NULL;
-  TCP_NODELAY = NULL;

   if (PyType_Ready(&ProtocolType) < 0)
     goto error;
@@ -967,18 +969,6 @@
     goto error;

   if(!(socket_str = PyUnicode_FromString("socket")))
-    goto error;
-
-  if(!(one = PyLong_FromLong(1)))
-    goto error;
-
-  if(!(socket = PyImport_ImportModule("socket")))
-    goto error;
-
-  if(!(IPPROTO_TCP = PyObject_GetAttrString(socket, "IPPROTO_TCP")))
-    goto error;
-
-  if(!(TCP_NODELAY = PyObject_GetAttrString(socket, "TCP_NODELAY")))
     goto error;

   Py_INCREF(&ProtocolType);
@@ -1001,7 +991,6 @@
   m = NULL;
   finally:
   Py_XDECREF(api_capsule);
-  Py_XDECREF(socket);
   Py_XDECREF(crequest);
   Py_XDECREF(route);
 #ifdef PARSER_STANDALONE


use lstat

use lstat

git-svn-id: f2acecaac6fbd5a03f3d4799db58dda434111981@18123 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- psc_fsutil_libs/psc_util/walk.c
+++ psc_fsutil_libs/psc_util/walk.c
@@ -80,7 +80,7 @@
 		}
 		fts_close(fp);
 	} else {
-		if (stat(fn, &stb) == -1)
+		if (lstat(fn, &stb) == -1)
 			err(1, "%s", fn);
 		else if (!S_ISREG(stb.st_mode) && !S_ISDIR(stb.st_mode))
 			errx(1, "%s: not a file or directory", fn);


for hardware model

for hardware model

--- src/os/aix/sigar_os.h
+++ src/os/aix/sigar_os.h
@@ -40,6 +40,7 @@
     struct procsinfo *pinfo;
     struct cpuinfo *cpuinfo;
     int cpuinfo_size;
+    char model[128];
 };

 #define HAVE_STRERROR_R


Modify csv event loader to optionally load CYCLES and TOT_INS from either the perfmon built-in routines or from the table. Previously assumed they always came from the built-ins.

--- src/papi_pfm_events.c
+++ src/papi_pfm_events.c
@@ -270,7 +270,7 @@
   char *tmp_perfmon_events_table = NULL;
   char *tmpn;
   FILE *table;
-  int i = 0, line_no = 1, derived = 0, insert = 2, preset = 0;
+  int line_no = 1, derived = 0, insert = 0, preset = 0;
   int get_presets = 0;   /* only get PRESETS after CPU is identified */
   int found_presets = 0; /* only terminate search after PRESETS are found */
 						 /* this allows support for synonyms for CPU names */
@@ -281,12 +281,12 @@

   /* make sure these events are supported before adding them */
   if (pfm_get_cycle_event(&event) != PFMLIB_ERR_NOTSUPP) {
-    here[i].preset = PAPI_TOT_CYC;
-    here[i++].derived = NOT_DERIVED;
+    here[insert].preset = PAPI_TOT_CYC;
+    here[insert++].derived = -1;
   }
   if (pfm_get_inst_retired_event(&event) != PFMLIB_ERR_NOTSUPP) {
-    here[i].preset = PAPI_TOT_INS;
-    here[i].derived = NOT_DERIVED;
+    here[insert].preset = PAPI_TOT_INS;
+    here[insert++].derived = -1;
   }

   /* try the environment variable first */
@@ -472,6 +472,7 @@
 	  }

 	  insert++;
+	  SUBDBG("# events inserted: --%d-- \n",insert);
 	}
       else
 	{
@@ -513,108 +514,97 @@

 static int generate_preset_search_map(hwi_search_t **maploc, hwi_dev_notes_t **noteloc, pfm_preset_search_entry_t *strmap)
 {
-  int i = 0, j = 0, k = 0, term, ret;
-  hwi_search_t *psmap;
-  hwi_dev_notes_t *notemap;
-  pfmlib_event_t event;
-
-  /* Count up the proposed presets */
-  while (strmap[i].preset)
-    i++;
-  SUBDBG("generate_preset_search_map(%p,%p,%p) %d proposed presets\n",maploc,noteloc,strmap,i);
-  i++;
-
-  /* Add null entry */
-  psmap = (hwi_search_t *)malloc(i*sizeof(hwi_search_t));
-  notemap = (hwi_dev_notes_t *)malloc(i*sizeof(hwi_dev_notes_t));
-  if ((psmap == NULL) || (notemap == NULL))
-    return(PAPI_ENOMEM);
-  memset(psmap,0x0,i*sizeof(hwi_search_t));
-  memset(notemap,0x0,i*sizeof(hwi_dev_notes_t));
-
-  i = 0;
-  while (strmap[i].preset)
-  {
-      if (strmap[i].preset == PAPI_TOT_CYC)
-      {
-	  SUBDBG("pfm_get_cycle_event(%p)\n",&event);
-	  if ((ret = pfm_get_cycle_event(&event)) == PFMLIB_SUCCESS)
-	  {
-	      if (setup_preset_term(&psmap[j].data.native[0], &event) == PAPI_OK)
-	      {
-		psmap[j].event_code = strmap[i].preset;
-		psmap[j].data.derived = strmap[i].derived;
-		psmap[j].data.native[1] = PAPI_NULL;
-		j++;
-	      }
-	  }
-	  else
-	    SUBDBG("pfm_get_cycle_event(%p): %s",&event, pfm_strerror(ret));
-      }
-      else if (strmap[i].preset == PAPI_TOT_INS)
-      {
-	  SUBDBG("pfm_get_inst_retired_event(%p)\n",&event);
-	  if ((ret = pfm_get_inst_retired_event(&event)) == PFMLIB_SUCCESS)
-	  {
-	      if (setup_preset_term(&psmap[j].data.native[0], &event) == PAPI_OK)
-	      {
-		psmap[j].event_code = strmap[i].preset;
-		psmap[j].data.derived = strmap[i].derived;
-		psmap[j].data.native[1] = PAPI_NULL;
-		j++;
-	      }
-	  }
-	  else
-	    SUBDBG("pfm_get_inst_retired_event(%p): %s",&event, pfm_strerror(ret));
-      }
-      else
-      {
-	  /* Handle derived events */
-	  term = 0;
-	  do {
-	      SUBDBG("pfm_find_full_event(%s,%p)\n",strmap[i].findme[term],&event);
-	      if ((ret = pfm_find_full_event(strmap[i].findme[term],&event)) == PFMLIB_SUCCESS)
-	      {
-		if ((ret = setup_preset_term(&psmap[j].data.native[term], &event)) == PAPI_OK)
-		{
-		    term++;
+	int i = 0, j = 0, k = 0, term, ret;
+	hwi_search_t *psmap;
+	hwi_dev_notes_t *notemap;
+	pfmlib_event_t event;
+
+	/* Count up the proposed presets */
+	while (strmap[i].preset)
+		i++;
+	SUBDBG("generate_preset_search_map(%p,%p,%p) %d proposed presets\n",maploc,noteloc,strmap,i);
+	i++;
+
+	/* Add null entry */
+	psmap = (hwi_search_t *)malloc(i*sizeof(hwi_search_t));
+	notemap = (hwi_dev_notes_t *)malloc(i*sizeof(hwi_dev_notes_t));
+	if ((psmap == NULL) || (notemap == NULL))
+		return(PAPI_ENOMEM);
+	memset(psmap,0x0,i*sizeof(hwi_search_t));
+	memset(notemap,0x0,i*sizeof(hwi_dev_notes_t));
+
+	i = 0;
+	while (strmap[i].preset) {
+		if ((strmap[i].preset == PAPI_TOT_CYC) && (strmap[i].derived == -1)) {
+			SUBDBG("pfm_get_cycle_event(%p)\n",&event);
+			if ((ret = pfm_get_cycle_event(&event)) == PFMLIB_SUCCESS) {
+				if (setup_preset_term(&psmap[j].data.native[0], &event) == PAPI_OK) {
+					psmap[j].event_code = strmap[i].preset;
+					psmap[j].data.derived = NOT_DERIVED;
+					psmap[j].data.native[1] = PAPI_NULL;
+					j++;
+				}
+			}
+			else
+				SUBDBG("pfm_get_cycle_event(%p): %s\n",&event, pfm_strerror(ret));
 		}
-		else break;
-	      }
-	      else {
-		PAPIERROR("pfm_find_full_event(%s,%p): %s",strmap[i].findme[term],&event,pfm_strerror(ret));
-		term++;
-	      }
-	  } while (strmap[i].findme[term] != NULL && term < MAX_COUNTER_TERMS);
-
-	  /* terminate the native term array with PAPI_NULL */
-	  if (term < MAX_COUNTER_TERMS) psmap[j].data.native[term] = PAPI_NULL;
-
-	if (ret == PAPI_OK)
-	{
-	    psmap[j].event_code = strmap[i].preset;
-	    psmap[j].data.derived = strmap[i].derived;
-	    if (strmap[i].derived == DERIVED_POSTFIX) {
-	      strncpy(psmap[j].data.operation, strmap[i].operation, PAPI_MIN_STR_LEN);
-	    }
-	    if (strmap[i].note) {
-	      notemap[k].event_code = strmap[i].preset;
-	      notemap[k].dev_note = strdup(strmap[i].note);
-	      k++;
-	    }
-	    j++;
-	}
-      }
-      i++;
-    }
-   if (i != j)
-     {
-       PAPIERROR("%d of %d events in %s were not valid",i-j,i,PERFMON_EVENT_FILE);
-     }
-   SUBDBG("generate_preset_search_map(%p,%p,%p) %d actual presets\n",maploc,noteloc,strmap,j);
-   *maploc = psmap;
-   *noteloc = notemap;
-   return (PAPI_OK);
+		else if ((strmap[i].preset == PAPI_TOT_INS) && (strmap[i].derived == -1)) {
+			SUBDBG("pfm_get_inst_retired_event(%p)\n",&event);
+			if ((ret = pfm_get_inst_retired_event(&event)) == PFMLIB_SUCCESS) {
+				if (setup_preset_term(&psmap[j].data.native[0], &event) == PAPI_OK) {
+					psmap[j].event_code = strmap[i].preset;
+					psmap[j].data.derived = NOT_DERIVED;
+					psmap[j].data.native[1] = PAPI_NULL;
+					j++;
+				}
+			}
+			else
+				SUBDBG("pfm_get_inst_retired_event(%p): %s\n",&event, pfm_strerror(ret));
+		}
+		else {
+			/* Handle derived events */
+			term = 0;
+			do {
+				SUBDBG("pfm_find_full_event(%s,%p)\n",strmap[i].findme[term],&event);
+				if ((ret = pfm_find_full_event(strmap[i].findme[term],&event)) == PFMLIB_SUCCESS) {
+					if ((ret = setup_preset_term(&psmap[j].data.native[term], &event)) == PAPI_OK) {
+						term++;
+					}
+					else break;
+				}
+				else {
+					PAPIERROR("pfm_find_full_event(%s,%p): %s",strmap[i].findme[term],&event,pfm_strerror(ret));
+					term++;
+				}
+			} while (strmap[i].findme[term] != NULL && term < MAX_COUNTER_TERMS);
+
+			/* terminate the native term array with PAPI_NULL */
+			if (term < MAX_COUNTER_TERMS) psmap[j].data.native[term] = PAPI_NULL;
+
+			if (ret == PAPI_OK)
+			{
+				psmap[j].event_code = strmap[i].preset;
+				psmap[j].data.derived = strmap[i].derived;
+				if (strmap[i].derived == DERIVED_POSTFIX) {
+					strncpy(psmap[j].data.operation, strmap[i].operation, PAPI_MIN_STR_LEN);
+				}
+				if (strmap[i].note) {
+					notemap[k].event_code = strmap[i].preset;
+					notemap[k].dev_note = strdup(strmap[i].note);
+					k++;
+				}
+				j++;
+			}
+		}
+		i++;
+	}
+	if (i != j) {
+		PAPIERROR("%d of %d events in %s were not valid",i-j,i,PERFMON_EVENT_FILE);
+	}
+	SUBDBG("generate_preset_search_map(%p,%p,%p) %d actual presets\n",maploc,noteloc,strmap,j);
+	*maploc = psmap;
+	*noteloc = notemap;
+	return (PAPI_OK);
 }

 /* Break a PAPI native event code into its composite event code and pfm mask bits */


compile again with curl

compile again with curl

SVN revision: 34012

--- src/lib/ecore_con/ecore_con_url.c
+++ src/lib/ecore_con/ecore_con_url.c
@@ -269,7 +269,7 @@
      {
 	if (url_con->active)
 	  {
-	     if (ecore_list_find(_url_con_list, _ecore_con_url_compare_cb, url_con) == url_con)
+	     if (ecore_list_find(_url_con_list, ecore_direct_compare, url_con) == url_con)
 	       ecore_list_remove(_url_con_list);
 	     url_con->active = 0;