GattCharacteristic: remove deprecated APIs and helper function SecurityModeToAttSecurity

--- features/FEATURE_BLE/ble/GattCharacteristic.h
+++ features/FEATURE_BLE/ble/GattCharacteristic.h
@@ -1426,32 +1426,6 @@
     }

 public:
-    /**
-     * Set up the minimum security (mode and level) requirements for access to
-     * the characteristic's value attribute.
-     *
-     * @param[in] securityMode Can be one of encryption or signing, with or
-     * without protection for man in the middle attacks (MITM).
-     *
-     * @deprecated Fine grained security check has been added to with mbed OS
-     * 5.9. It is possible to set independently security requirements for read,
-     * write and update operations. In the meantime SecurityManager::SecurityMode_t
-     * is not used anymore to represent security requirements as it maps
-     * incorrectly the Bluetooth standard.
-     */
-    MBED_DEPRECATED_SINCE(
-        "mbed-os-5.9",
-        "Use setWriteSecurityRequirements, setReadSecurityRequirements and "
-        "setUpdateSecurityRequirements"
-    )
-    void requireSecurity(SecurityManager::SecurityMode_t securityMode)
-    {
-        SecurityRequirement_t sec_requirements = SecurityModeToAttSecurity(securityMode);
-
-        _valueAttribute.setReadSecurityRequirement(sec_requirements);
-        _valueAttribute.setWriteSecurityRequirement(sec_requirements);
-        _update_security = sec_requirements.value();
-    }

     /**
      * Set all security requirements of the characteristic.
@@ -1730,62 +1704,6 @@
     }

     /**
-     * Get the characteristic's required security.
-     *
-     * @return The characteristic's required security.
-     *
-     * @deprecated Fine grained security check has been added to with mbed OS
-     * 5.9. It is possible to set independently security requirements for read,
-     * write and update operations. In the meantime SecurityManager::SecurityMode_t
-     * is not used anymore to represent security requirements as it maps
-     * incorrectly the Bluetooth standard.
-     */
-    MBED_DEPRECATED_SINCE(
-        "mbed-os-5.9",
-        "Use getWriteSecurityRequirements, getReadSecurityRequirements and "
-        "getUpdateSecurityRequirements"
-    )
-    SecurityManager::SecurityMode_t getRequiredSecurity() const
-    {
-        SecurityRequirement_t max_sec = std::max(
-            std::max(
-                getReadSecurityRequirement(),
-                getWriteSecurityRequirement()
-            ),
-            getUpdateSecurityRequirement()
-        );
-
-        bool needs_signing =
-            _properties & BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES;
-
-        switch(max_sec.value()) {
-            case SecurityRequirement_t::NONE:
-                MBED_ASSERT(needs_signing == false);
-                return SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK;
-#if BLE_FEATURE_SECURITY
-            case SecurityRequirement_t::UNAUTHENTICATED:
-                return (needs_signing) ?
-                    SecurityManager::SECURITY_MODE_SIGNED_NO_MITM :
-                    SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM;
-
-            case SecurityRequirement_t::AUTHENTICATED:
-                return (needs_signing) ?
-                    SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM :
-                    SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM;
-#if BLE_FEATURE_SECURE_CONNECTIONS
-            case SecurityRequirement_t::SC_AUTHENTICATED:
-                MBED_ASSERT(needs_signing == false);
-                // fallback to encryption with MITM
-                return SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM;
-#endif // BLE_FEATURE_SECURE_CONNECTIONS
-#endif // BLE_FEATURE_SECURITY
-            default:
-                MBED_ASSERT(false);
-                return SecurityManager::SECURITY_MODE_NO_ACCESS;
-        }
-    }
-
-    /**
      * Get the total number of descriptors within this characteristic.
      *
      * @return The total number of descriptors.
@@ -1839,42 +1757,6 @@
     }

 private:
-
-    /**
-     * Loosely convert a SecurityManager::SecurityMode_t into a
-     * SecurityRequirement_t.
-     *
-     * @param[in] mode The security mode to convert
-     *
-     * @return The security requirement equivalent to the security mode in input.
-     */
-    SecurityRequirement_t SecurityModeToAttSecurity(
-        SecurityManager::SecurityMode_t mode
-    ) {
-        switch(mode) {
-            case SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK:
-            case SecurityManager::SECURITY_MODE_NO_ACCESS:
-                // assuming access is managed by property and orthogonal to
-                // security mode ...
-                return SecurityRequirement_t::NONE;
-#if BLE_FEATURE_SECURITY
-            case SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM:
-#if BLE_FEATURE_SIGNING
-            case SecurityManager::SECURITY_MODE_SIGNED_NO_MITM:
-#endif
-                return SecurityRequirement_t::UNAUTHENTICATED;
-
-            case SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM:
-#if BLE_FEATURE_SIGNING
-            case SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM:
-#endif
-                return SecurityRequirement_t::AUTHENTICATED;
-#endif // BLE_FEATURE_SECURITY
-            default:
-                // should not happens; makes the compiler happy.
-                return SecurityRequirement_t::NONE;
-        }
-    }

     /**
      * Attribute that contains the actual value of this characteristic.


Fix multiple definitions link error.

Fix multiple definitions link error.

--- base/result_testing.h
+++ base/result_testing.h
@@ -13,9 +13,10 @@

 // Implementation {{{

-::testing::AssertionResult ResultCodeEQ(const char* code_text,
-                                        const char* expr_text,
-                                        Result::Code code, const Result& expr) {
+inline ::testing::AssertionResult ResultCodeEQ(const char* code_text,
+                                               const char* expr_text,
+                                               Result::Code code,
+                                               const Result& expr) {
   auto cast = [](Result::Code code) {
     return static_cast<uint16_t>(static_cast<uint8_t>(code));
   };


INTEGRATION: CWS ooo19126 (1.4.584); FILE MERGED 2005/09/05 13:05:22 rt 1.4.584.1: #i54170# Change license header: remove SISSL

--- framework/inc/threadhelp/irwlock.h
+++ framework/inc/threadhelp/irwlock.h
@@ -1,61 +1,35 @@
 /*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
  *
  *  $RCSfile: irwlock.h,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.5 $
  *
- *  last change: $Author: as $ $Date: 2001-06-11 10:23:35 $
+ *  last change: $Author: rt $ $Date: 2005-09-09 00:36:45 $
  *
- *  The Contents of this file are made available subject to the terms of
- *  either of the following licenses
- *
- *         - GNU Lesser General Public License Version 2.1
- *         - Sun Industry Standards Source License Version 1.1
- *
- *  Sun Microsystems Inc., October, 2000
- *
- *  GNU Lesser General Public License Version 2.1
- *  =============================================
- *  Copyright 2000 by Sun Microsystems, Inc.
- *  901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *  MA  02111-1307  USA
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
  *
  *
- *  Sun Industry Standards Source License Version 1.1
- *  =================================================
- *  The contents of this file are subject to the Sun Industry Standards
- *  Source License Version 1.1 (the "License"); You may not use this file
- *  except in compliance with the License. You may obtain a copy of the
- *  License at http://www.openoffice.org/license.html.
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
  *
- *  Software provided under this License is provided on an "AS IS" basis,
- *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- *  See the License for the specific provisions governing your rights and
- *  obligations concerning the Software.
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
  *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
  *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
  *
  ************************************************************************/


Check before usage

Check before usage

 The `properties` pointer must be checked before accessing to its
 members.

--- wsf_c/axis2c/util/src/properties.c
+++ wsf_c/axis2c/util/src/properties.c
@@ -72,6 +72,11 @@
     axis2_char_t *value = NULL;
     axutil_hash_index_t *hi = NULL;

+    if(!properties)
+    {
+        return;
+    }
+
     if(properties->prop_hash)
     {
         for(hi = axutil_hash_first(properties->prop_hash, env); hi; hi = axutil_hash_next(env, hi))
@@ -89,10 +94,7 @@
         axutil_hash_free(properties->prop_hash, env);
     }

-    if(properties)
-    {
-        AXIS2_FREE(env->allocator, properties);
-    }
+    AXIS2_FREE(env->allocator, properties);
     return;
 }


Decreased gfx task priority

Decreased gfx task priority

--- Middlewares/ugfx/src/gos/gos_freertos.h
+++ Middlewares/ugfx/src/gos/gos_freertos.h
@@ -56,7 +56,7 @@

 #define MAX_SEMAPHORE_COUNT	((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
 #define LOW_PRIORITY		0
-#define NORMAL_PRIORITY		configMAX_PRIORITIES/2
+#define NORMAL_PRIORITY		1
 #define HIGH_PRIORITY		configMAX_PRIORITIES-1

 /* FreeRTOS will allocate the stack when creating the thread, so pass the size instead of a working area */


MFC r279987: Add checksums to identify data and NCQ command error log.

--- usr.sbin/bhyve/pci_ahci.c
+++ usr.sbin/bhyve/pci_ahci.c
@@ -794,6 +794,17 @@
 }

 static void
+ahci_checksum(uint8_t *buf, int size)
+{
+	int i;
+	uint8_t sum = 0;
+
+	for (i = 0; i < size - 1; i++)
+		sum += buf[i];
+	buf[size - 1] = 0x100 - sum;
+}
+
+static void
 ahci_handle_read_log(struct ahci_port *p, int slot, uint8_t *cfis)
 {
 	struct ahci_cmd_hdr *hdr;
@@ -809,6 +820,7 @@

 	memset(buf, 0, sizeof(buf));
 	memcpy(buf, p->err_cfis, sizeof(p->err_cfis));
+	ahci_checksum(buf, sizeof(buf));

 	if (cfis[2] == ATA_READ_LOG_EXT)
 		ahci_write_fis_piosetup(p);
@@ -915,6 +927,8 @@
 		buf[119] = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14);
 		buf[120] = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14);
 		buf[222] = 0x1020;
+		buf[255] = 0x00a5;
+		ahci_checksum((uint8_t *)buf, sizeof(buf));
 		ahci_write_fis_piosetup(p);
 		write_prdt(p, slot, cfis, (void *)buf, sizeof(buf));
 		ahci_write_fis_d2h(p, slot, cfis, ATA_S_DSC | ATA_S_READY);
@@ -963,6 +977,8 @@
 		if (p->xfermode & ATA_UDMA0)
 			buf[88] |= (1 << ((p->xfermode & 7) + 8));
 		buf[222] = 0x1020;
+		buf[255] = 0x00a5;
+		ahci_checksum((uint8_t *)buf, sizeof(buf));
 		ahci_write_fis_piosetup(p);
 		write_prdt(p, slot, cfis, (void *)buf, sizeof(buf));
 		ahci_write_fis_d2h(p, slot, cfis, ATA_S_DSC | ATA_S_READY);


Added capture to streq

Added capture to streq

--- engine/core_operators.c
+++ engine/core_operators.c
@@ -228,6 +228,13 @@
         IB_FTRACE_RET_STATUS(IB_EINVAL);
     }

+    if ( (*result != 0) &&
+         (ib_flags_all(rule->flags, IB_RULE_FLAG_CAPTURE) == true) )
+    {
+        ib_data_capture_clear(tx);
+        ib_data_capture_set_item(tx, 0, field);
+    }
+
     IB_FTRACE_RET_STATUS(IB_OK);
 }


hcidump: Use more clear data types for the frame structure

--- tools/parser/parser.h
+++ tools/parser/parser.h
@@ -32,19 +32,19 @@
 #include <netinet/in.h>

 struct frame {
-	void	*data;
-	int	data_len;
-	void	*ptr;
-	int	len;
-	int	in;
-	int	master;
-	int	handle;
-	int	cid;
-	int	num;
-	int	dlci;
-	int	channel;
-	long	flags;
-	struct	timeval ts;
+	void		*data;
+	uint32_t	data_len;
+	void		*ptr;
+	uint32_t	len;
+	uint8_t		in;
+	uint8_t		master;
+	uint16_t	handle;
+	uint16_t	cid;
+	uint16_t	num;
+	uint8_t		dlci;
+	uint8_t		channel;
+	unsigned long	flags;
+	struct timeval	ts;
 };

 /* Parser flags */


COMMON: Queue Deadlock

COMMON: Queue Deadlock

common/queue will deadlock when exceeds the maximum queue size as it does
not release the lock prior to returning with full status.

Signed-off-by: Philip Preston <a2fd5a312e8e7f75b264f4f3a0d32d349b5d0f49@nyx.com>

--- common/c_cpp/src/c/queue.c
+++ common/c_cpp/src/c/queue.c
@@ -201,7 +201,10 @@
     item = impl->mFirstFree.mNext;

     if (item == NULL)
+    {
+        wthread_mutex_unlock(&impl->mLock);
         return WOMBAT_QUEUE_FULL;
+    }

     impl->mFirstFree.mNext = item->mNext;
     /* Initialize the item. */
@@ -558,7 +561,10 @@
     item = impl->mFirstFree.mNext;

     if (item == NULL)
+    {
+        wthread_mutex_unlock (&impl->mLock);
         return WOMBAT_QUEUE_FULL;
+    }

     impl->mFirstFree.mNext = item->mNext;
     /* Initialize the item. */
@@ -602,7 +608,10 @@
     item = impl->mFirstFree.mNext;

     if (item == NULL)
+    {
+        wthread_mutex_unlock (&impl->mLock);
         return WOMBAT_QUEUE_FULL;
+    }

     impl->mFirstFree.mNext = item->mNext;
     /* Initialize the item. */


Removed handle_messages() debug lines.

Removed handle_messages() debug lines.

--- protocols/rdp/src/guac_handlers.c
+++ protocols/rdp/src/guac_handlers.c
@@ -78,8 +78,6 @@

     fd_set rfds, wfds;

-    guac_client_log_info(client, "handle_messages() start");
-
     /* get rdp fds */
     if (!freerdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count)) {
         guac_client_log_error(client, "Unable to read RDP file descriptors.");
@@ -143,7 +141,6 @@
     }

     /* Success */
-    guac_client_log_info(client, "handle_messages() end");
     return 0;

 }


workaround for lack of sufficient transport events from ssl

--- proton-c/src/reactor/connection.c
+++ proton-c/src/reactor/connection.c
@@ -156,7 +156,9 @@
   }

   ssize_t newcap = pn_transport_capacity(transport);
-  if (newcap != capacity) {
+  //occasionally transport events aren't generated when expected, so
+  //the following hack ensures we always update the selector
+  if (1 || newcap != capacity) {
     pni_connection_update(sel);
     pn_reactor_update(reactor, sel);
   }


[xcbuf] 循環バッファモジュールの追加

[xcbuf] 循環バッファモジュールの追加

error: pathspec 'picox/container/xcircular_buffer.h' did not match any file(s) known to git

--- picox/container/xcircular_buffer.h
+++ picox/container/xcircular_buffer.h
@@ -0,0 +1,396 @@
+/**
+ *       @file  xcircular_buffer.h
+ *      @brief
+ *
+ *    @details
+ *
+ *     @author  MaskedW
+ *
+ *   @internal
+ *     Created  2016/05/23
+ * ===================================================================
+ */
+
+/*
+ * License: MIT license
+ * Copyright (c) <2016> <MaskedW [maskedw00@gmail.com]>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+#ifndef picox_container_xcircular_buffer_h_
+#define picox_container_xcircular_buffer_h_
+
+
+#include <picox/core/xcore.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#define XCBUF__CAPACITY()    ((size_t)(self->m_end - self->m_buff))
+#define XCBUF__ADD(p, n)     ((p) + ((n) < (size_t)(self->m_end - (p)) ? (n) : (n) - XCBUF__CAPACITY()))
+#define XCBUf__SUB(p, n)     ((p) - ((n) > ((p) - self->m_buff) ? (n) - XCBUF__CAPACITY() : (n)))
+#define XCBUF__DECREMENT(p)  do { if (p == self->m_buff) p = self->m_end; --p; } while (0)
+#define XCBUF__INCREMENT(p)  do { if (++p == self->m_end) p = self->m_buff; } while (0)
+
+
+typedef struct
+{
+/** @privatesection */
+    uint8_t*    m_buff;
+    uint8_t*    m_end;
+    uint8_t*    m_first;
+    uint8_t*    m_last;
+    size_t      m_size;
+    bool        m_is_heapdata;
+} XCircularBuffer;
+
+
+static inline bool
+xcbuf_init(XCircularBuffer* self, void* buffer, size_t capacity)
+{
+    if (!buffer)
+    {
+        buffer = (uint8_t*)x_malloc(capacity);
+        if (!buffer)
+            return false;
+        self->m_is_heapdata = true;
+    }
+    self->m_buff = (uint8_t*)buffer;
+    self->m_end = self->m_buff + capacity;
+    self->m_first = self->m_last = self->m_buff;
+    self->m_size = 0;
+}
+
+
+static inline void
+xcbuf_deinit(XCircularBuffer* self)
+{
+    if (self->m_is_heapdata)
+        x_free(self->m_buff);
+    self->m_is_heapdata = false;
+    self->m_buff = NULL;
+}
+
+
+static inline void
+xcbuf_clear(XCircularBuffer* self)
+{
+    self->m_first = self->m_last = self->m_buff;
+    self->m_size = 0;
+}
+
+
+static inline uint8_t*
+xcbuf_data(XCircularBuffer* self)
+{
+    return self->m_buff;
+}
+
+
+static inline const uint8_t*
+xcbuf_const_data(const XCircularBuffer* self)
+{
+    return self->m_buff;
+}
+
+
+static inline const uint8_t*
+xcbuf_array_one(const XCircularBuffer* self, size_t* o_size)
+{
+    const uint8_t* p = ((self->m_last <= self->m_first) && (self->m_size != 0)) ?
+                         self->m_end : self->m_last;
+    *o_size = p - self->m_first;
+    return self->m_first;
+}
+
+
+static inline const uint8_t*
+xcbuf_array_two(const XCircularBuffer* self, size_t* o_size)
+{
+    *o_size = ((self->m_last <= self->m_first) && (self->m_size != 0)) ?
+               self->m_last - self->m_buff : 0;
+    return self->m_buff;
+}
+
+
+static inline uint8_t*
+xcbuf_linearize(XCircularBuffer* self)
+{
+    if (self->m_size == 0)
+        return NULL;
+
+    if ((self->m_first < self->m_last) || (self->m_last == self->m_buff))
+        return self->m_first;
+
+    uint8_t* src = self->m_first;
+    uint8_t* dest = self->m_buff;
+    size_t moved = 0;
+    uint8_t* first;
+    uint8_t tmp;
+    size_t i;
+    for (first = self->m_first; dest < src; src = first)
+    {
+        for (i = 0; src < self->m_end; ++src, ++dest, ++moved, ++i)
+        {
+            if (moved == self->m_size)
+            {
+                first = dest;
+                break;
+            }
+            if (dest == first)
+            {
+                first += i;
+                break;
+            }
+            tmp = *src;
+            *src = *dest;
+            *dest = tmp;
+        }
+    }
+
+    self->m_first = self->m_buff;
+    self->m_last = XCBUF__ADD(self->m_buff, self->m_size);
+    return self->m_buff;
+}
+
+
+static inline bool
+xcbuf_is_linearized(const XCircularBuffer* self)
+{
+    return (self->m_first < self->m_last) || (self->m_last == self->m_buff);
+}
+
+
+static inline size_t
+xcbuf_size(const XCircularBuffer* self)
+{
+    return self->m_size;
+}
+
+
+static inline bool
+xcbuf_empty(const XCircularBuffer* self)
+{
+    return self->m_size == 0;
+}
+
+
+static inline size_t
+xcbuf_capacity(const XCircularBuffer* self)
+{
+    return XCBUF__CAPACITY();
+}
+
+
+static inline bool
+xcbuf_full(const XCircularBuffer* self)
+{
+    return XCBUF__CAPACITY() == self->m_size;
+}
+
+
+static inline size_t
+xcbuf_reserve(const XCircularBuffer* self)
+{
+    return XCBUF__CAPACITY() - self->m_size;
+}
+
+
+static inline void
+xcbuf_push_back(XCircularBuffer* self, uint8_t value)
+{
+    if (xcbuf_full(self))
+    {
+        *(self->m_last) = value;
+        XCBUF__INCREMENT(self->m_last);
+        self->m_first = self->m_last;
+    }
+    else
+    {
+        *(self->m_last) = value;
+        XCBUF__INCREMENT(self->m_last);
+        self->m_size++;
+    }
+}
+
+
+static inline void
+xcbuf_push_back_n(XCircularBuffer* self, const void* src, size_t n)
+{
+    const size_t reserved = xcbuf_reserve(self);
+    const size_t nn = (reserved >= n) ? n : reserved;
+    size_t i;
+    const uint8_t* p = (const uint8_t*)src;
+
+    for (i = 0; i < nn; i++)
+    {
+        *(self->m_last) = *p++;
+        XCBUF__INCREMENT(self->m_last);
+        self->m_size++;
+    }
+
+    for (; i < n; i++)
+    {
+        *(self->m_last) = *p++;
+        XCBUF__INCREMENT(self->m_last);
+        self->m_first = self->m_last;
+    }
+}
+
+
+static inline void
+xcbuf_push_front(XCircularBuffer* self, uint8_t value)
+{
+    if (xcbuf_full(self))
+    {
+        XCBUF__DECREMENT(self->m_first);
+        *(self->m_first) = value;
+        self->m_last = self->m_first;
+    }
+    else
+    {
+        XCBUF__DECREMENT(self->m_first);
+        *(self->m_first) = value;
+        self->m_size++;
+    }
+}
+
+
+static inline void
+xcbuf_push_front_n(XCircularBuffer* self, const void* src, size_t n)
+{
+    const size_t reserved = xcbuf_reserve(self);
+    const size_t nn = (reserved >= n) ? n : reserved;
+    const uint8_t* p = (const uint8_t*)(src);
+    size_t i;
+
+    for (i = 0; i < nn; i++)
+    {
+        XCBUF__DECREMENT(self->m_first);
+        *(self->m_first) = *p++;
+        self->m_size++;
+    }
+
+    for (; i < n; i++)
+    {
+        XCBUF__DECREMENT(self->m_first);
+        *(self->m_first) = *p++;
+        self->m_last = self->m_first;
+    }
+}
+
+
+static inline uint8_t
+xcbuf_pop_back(XCircularBuffer* self)
+{
+    XCBUF__DECREMENT(self->m_last);
+    const uint8_t ret = *(self->m_last);
+    self->m_size--;
+    return ret;
+}
+
+
+static inline uint8_t
+xcbuf_pop_front(XCircularBuffer* self)
+{
+    const uint8_t ret = *(self->m_first);
+    XCBUF__INCREMENT(self->m_first);
+    self->m_size--;
+    return ret;
+}
+
+
+static inline void
+xcbuf_pop_front_n(XCircularBuffer* self, void* dst, size_t n)
+{
+    size_t i;
+    uint8_t* p;
+    if (dst)
+    {
+        p = (uint8_t*)dst;
+        for (i = 0; i < n; i++)
+        {
+            *p++ = *(self->m_first);
+            XCBUF__INCREMENT(self->m_first);
+        }
+    }
+    else
+    {
+        for (i = 0; i < n; i++)
+        {
+            XCBUF__INCREMENT(self->m_first);
+        }
+    }
+    self->m_size -= n;
+}
+
+
+static inline void
+xcbuf_pop_back_n(XCircularBuffer* self, void* dst, size_t n)
+{
+    size_t i;
+    uint8_t* p;
+    if (dst)
+    {
+        p = (uint8_t*)dst;
+        for (i = 0; i < n; i++)
+        {
+            XCBUF__DECREMENT(self->m_last);
+            *p++ = *(self->m_last);
+        }
+    }
+    else
+    {
+        for (i = 0; i < n; i++)
+        {
+            XCBUF__DECREMENT(self->m_last);
+        }
+    }
+    self->m_size -= n;
+}
+
+
+static inline void
+xcbuf_copy_to_mem(const XCircularBuffer* self, size_t pos, void* dst, size_t n)
+{
+    const uint8_t* src = XCBUF__ADD(self->m_first, pos);
+    uint8_t* p = (uint8_t*)dst;
+    size_t i;
+    for (i = 0; i < n; i++)
+    {
+        *p++ = *src;
+        XCBUF__INCREMENT(src);
+    }
+
+}
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* picox_container_xcircular_buffer_h_ */


and include ldns for windows anchor update

git-svn-id: 5ac9340a55e2f27e0b201b4c317755fd16d51776@2083 be551aaa-1e26-0410-a405-d3ace91eadb9

--- winrc/anchor-update.c
+++ winrc/anchor-update.c
@@ -40,6 +40,7 @@
  * windows (no shell).
  */
 #include "config.h"
+#include "ldns/ldns.h"
 #include "libunbound/unbound.h"

 /** usage */


Don't assume the parent's position (bounds).

--- wm/sawman/sawman_wm.c
+++ wm/sawman/sawman_wm.c
@@ -2715,8 +2715,6 @@
           ret = fusion_vector_add( &parent->children, sawwin );
           if (ret)
                return ret;
-
-          window->config.bounds = parent->window->config.bounds;
      }

      sawman_update_geometry( sawwin );


Fixed mode of computed_value_SymConst
Enhanced computed value of Div/Mod nodes

[r3661]

--- ir/ir/iropt.c
+++ ir/ir/iropt.c
@@ -53,16 +53,22 @@
     return tarval_bad;
 }

+/**
+ * return the value of a Constant
+ */
 static tarval *computed_value_Const(ir_node *n)
 {
     return get_Const_tarval(n);
 }

+/**
+ * return the value of a 'sizeof' SymConst
+ */
 static tarval *computed_value_SymConst(ir_node *n)
 {
-  if ((get_SymConst_kind(n) ==symconst_size) &&
+  if ((get_SymConst_kind(n) == symconst_size) &&
       (get_type_state(get_SymConst_type(n))) == layout_fixed)
-    return new_tarval_from_long(get_type_size_bytes(get_SymConst_type(n)), mode_Is);
+    return new_tarval_from_long(get_type_size_bytes(get_SymConst_type(n)), get_irn_mode(n));
   return tarval_bad;
 }

@@ -346,12 +352,13 @@
      3. The predecessors are Allocs or void* constants.  Allocs never
 	return NULL, they raise an exception.   Therefore we can predict
 	the Cmp result. */
-  if (get_irn_op(a) == op_Cmp) {
+  switch (get_irn_opcode(a)) {
+  case iro_Cmp:
     aa = get_Cmp_left(a);
     ab = get_Cmp_right(a);

     if (aa == ab) { /* 1.: */
-      /* This is a tric with the bits used for encoding the Cmp
+      /* This is a trick with the bits used for encoding the Cmp
 	 Proj numbers, the following statement is not the same:
       return new_tarval_from_long ((get_Proj_proj(n) == Eq), mode_b) */
       return new_tarval_from_long ((get_Proj_proj(n) & Eq), mode_b);
@@ -393,18 +400,54 @@
 	  return new_tarval_from_long (get_Proj_proj(n) & Ne, mode_b);
       }
     }
-  } else if (get_irn_op(a) == op_DivMod) {
+    break;
+
+  case iro_DivMod:
+  {
     tarval *tb = value_of(b = get_DivMod_right(a));
     tarval *ta = value_of(a = get_DivMod_left(a));

     if ((ta != tarval_bad)  && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
       if (tb == get_mode_null(get_tarval_mode(tb)))  /* div by zero: return tarval_bad */
 	return tarval_bad;
-      if (get_Proj_proj(n)== 0) /* Div */
+      if (get_Proj_proj(n)== pn_DivMod_res_div)
 	return tarval_div(ta, tb);
-      else /* Mod */
+      else if (get_Proj_proj(n)== pn_DivMod_res_mod)
 	return tarval_mod(ta, tb);
     }
+    break;
+  }
+
+  case iro_Div:
+  {
+    tarval *tb = value_of(b = get_Div_right(a));
+    tarval *ta = value_of(a = get_Div_left(a));
+
+    if ((ta != tarval_bad)  && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+      if (tb == get_mode_null(get_tarval_mode(tb)))  /* div by zero: return tarval_bad */
+	return tarval_bad;
+      if (get_Proj_proj(n)== pn_Div_res)
+	return tarval_div(ta, tb);
+    }
+    break;
+  }
+
+  case iro_Mod:
+  {
+    tarval *tb = value_of(b = get_Mod_right(a));
+    tarval *ta = value_of(a = get_Mod_left(a));
+
+    if ((ta != tarval_bad)  && (tb != tarval_bad) && (get_irn_mode(a) == get_irn_mode(b))) {
+      if (tb == get_mode_null(get_tarval_mode(tb)))  /* div by zero: return tarval_bad */
+	return tarval_bad;
+      if (get_Proj_proj(n)== pn_Mod_res)
+	return tarval_mod(ta, tb);
+    }
+    break;
+  }
+
+  default:
+    return tarval_bad;
   }
   return tarval_bad;
 }
@@ -412,6 +455,8 @@
 /**
  * If the parameter n can be computed, return its value, else tarval_bad.
  * Performs constant folding.
+ *
+ * @param n  The node this should be evaluated
  */
 tarval *computed_value(ir_node *n)
 {


tweak -s odtables further

tweak -s odtables further

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

--- psc_fsutil_libs/psc_util/ctlcli.c
+++ psc_fsutil_libs/psc_util/ctlcli.c
@@ -978,7 +978,7 @@
 psc_ctlmsg_odtable_prhdr(__unusedx struct psc_ctlmsghdr *mh,
     __unusedx const void *m)
 {
-	printf("%-47s %3s %6s %7s %7s %5s\n",
+	printf("%-46s %3s %6s %7s %7s %6s\n",
 	    "on-disk-table", "flg", "elemsz", "inuse", "total", "%use");
 }

@@ -990,8 +990,8 @@
 	char buf[PSCFMT_RATIO_BUFSIZ];

 	psc_fmt_ratio(buf, pco->pco_inuse, pco->pco_total);
-	printf("%-47s  %c%c "
-	    "%6d %7d %7d %5s\n",
+	printf("%-46s  %c%c "
+	    "%6d %7d %7d %6s\n",
 	    pco->pco_name,
 	    pco->pco_opts & ODTBL_OPT_CRC	? 'c' : '-',
 	    pco->pco_opts & ODTBL_OPT_SYNC	? 's' : '-',


Simplify constraints on operator co_await for SingleTypedSenders

Summary: Because of the guard against constraint recursion in the definition of `struct awaitable_sender_traits` (awaitable/concepts.h, line 75), there is no need to be so conservative with the constraints of the generic `operator co_await` for `SingleTypedSender`s.

Reviewed By: kirkshoop

Differential Revision: D14816672

fbshipit-source-id: b2f49588ae98ea63a24f4044692470c59be15e29

--- folly/experimental/pushmi/awaitable/senders.h
+++ folly/experimental/pushmi/awaitable/senders.h
@@ -180,7 +180,7 @@
   // from within the body of the awaiting coroutine, do:
   // `using namespace ::folly::pushmi::awaitable_senders;`
   PUSHMI_TEMPLATE(class From)( //
-    requires not lazy::Awaiter<From> && lazy::SingleTypedSender<From> //
+    requires not Awaiter<From> && SingleTypedSender<From> //
   ) //
   sender_awaiter<From> operator co_await(From&& from) {
     return static_cast<From&&>(from);


hush simple cast warning

hush simple cast warning

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

--- psc_fsutil_libs/psc_util/ctlsvr.c
+++ psc_fsutil_libs/psc_util/ctlsvr.c
@@ -494,7 +494,7 @@
 			if (set)
 				thr->pscthr_loglevels[subsys] = loglevel;
 			else {
-				levels[2] = psc_subsys_name(subsys);
+				levels[2] = (char*)psc_subsys_name(subsys);
 				rc = psc_ctlmsg_param_send(fd, mh, pcp,
 				    thr->pscthr_name, levels, 3,
 				    psc_loglevel_getname(thr->


better yet: completely disable all parameter setting for nonprivileged users

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

--- psc_fsutil_libs/psc_util/ctlsvr.c
+++ psc_fsutil_libs/psc_util/ctlsvr.c
@@ -575,6 +575,7 @@

 	if (set && strcmp(pcp->pcp_thrname, PCTHRNAME_EVERYONE) == 0)
 		psc_log_setlevel(subsys, loglevel);
+		/* XXX optimize: bail */

 	rc = 1;
 	found = 0;
@@ -1085,24 +1086,12 @@
     struct psc_ctlparam_node *pcn)
 {
 	char val[PCP_VALUE_MAX];
-	uid_t uid;
-	gid_t gid;
-	int rc;

 	if (strcmp(pcp->pcp_thrname, PCTHRNAME_EVERYONE) != 0)
 		return (psc_ctlsenderr(fd, mh, "invalid thread field"));

 	if (mh->mh_type == PCMT_SETPARAM) {
 		if (pcn->pcn_setf) {
-			rc = pfl_socket_getpeercred(fd, &uid, &gid);
-			if (rc == 0 && uid)
-				rc = EPERM;
-			if (rc)
-				return (psc_ctlsenderr(fd, mh,
-				    "%s: %s",
-				    psc_ctlparam_fieldname(
-				      pcp->pcp_field, nlevels),
-				    strerror(rc)));
 			if (pcn->pcn_setf(pcp->pcp_value))
 				return (psc_ctlsenderr(fd, mh,
 				    "%s: invalid value: %s",
@@ -1129,6 +1118,8 @@
 	struct psclist_head stack;
 	char *t, *levels[MAX_LEVELS];
 	int n, k, nlevels, set, rc = 1;
+	uid_t uid;
+	gid_t gid;

 	pcf = NULL;
 	INIT_PSCLIST_HEAD(&stack);
@@ -1159,6 +1150,14 @@
 		    "%s: parameter field exceeds maximum depth",
 		    psc_ctlparam_fieldname(pcp->pcp_field,
 		    MAX_LEVELS)));
+
+	rc = pfl_socket_getpeercred(fd, &uid, &gid);
+	if (rc == 0 && uid)
+		rc = EPERM;
+	if (rc)
+		return (psc_ctlsenderr(fd, mh, "%s: %s",
+		    psc_ctlparam_fieldname(pcp->pcp_field, nlevels),
+		    strerror(rc)));

 	pcf = PSCALLOC(sizeof(*pcf));
 	INIT_PSC_LISTENTRY(&pcf->pcf_lentry);


cleaning BaseContext

cleaning BaseContext

Former-commit-id: 757f089314f94875c125e1a0274d43d21a32971d

--- framework/sofa/core/objectmodel/BaseContext.h
+++ framework/sofa/core/objectmodel/BaseContext.h
@@ -30,7 +30,11 @@
 #include <sofa/core/objectmodel/Tag.h>
 #include <sofa/core/objectmodel/ClassInfo.h>
 #include <sofa/core/ExecParams.h>
+
+#ifdef SOFA_SUPPORT_MOVING_FRAMES
 #include <sofa/defaulttype/SolidTypes.h>
+#endif
+
 #include <set>
 #ifdef SOFA_SMP
 #include <IterativePartition.h>
@@ -92,14 +96,17 @@
     /// @name Types defined for local coordinate system handling
     /// @{

+#ifdef SOFA_SUPPORT_MOVING_FRAMES
     typedef defaulttype::SolidTypes<SReal> SolidTypes;
-
     typedef SolidTypes::Transform Frame;
-    typedef SolidTypes::Vec Vec3;
-    typedef SolidTypes::Rot Quat;
-    typedef SolidTypes::Mat Mat33;
     typedef SolidTypes::SpatialVector SpatialVector;
-    /// @}
+#endif
+//    typedef SolidTypes::Rot Quat;
+//    typedef SolidTypes::Mat Mat33;
+    /// @}
+
+    typedef defaulttype::Vector3 Vec3;
+
 protected:
     BaseContext();
     virtual ~BaseContext();
@@ -126,7 +133,7 @@
 #endif

     /// State of the context
-    virtual void setActive(bool) {};
+    virtual void setActive(bool) {}

 	/// Sleeping state of the context
 	virtual bool isSleeping() const;


GBP: format include EPG index

GBP: format include EPG index

Change-Id: I1789a4ea44cfc6a11ad8750074ffcf14c4ab8712
Signed-off-by: Neale Ranns <b9c0e9ef0223633bc2f318425f615cf5840a0be7@cisco.com>

--- src/plugins/gbp/gbp_endpoint_group.c
+++ src/plugins/gbp/gbp_endpoint_group.c
@@ -331,7 +331,8 @@
   vnet_main_t *vnm = vnet_get_main ();

   if (NULL != gg)
-    s = format (s, "%d, sclass:%d bd:[%d,%d], rd:[%d] uplink:%U locks:%d",
+    s = format (s, "[%d] %d, sclass:%d bd:[%d,%d], rd:[%d] uplink:%U locks:%d",
+                gg - gbp_endpoint_group_pool,
                 gg->gg_id,
                 gg->gg_sclass,
                 gbp_endpoint_group_get_bd_id(gg), gg->gg_bd_index,


KAA-1: Minor fix. Add guard macro for the ext_log_upload_strategy_by_volume.c

--- client/client-multi/client-c/src/kaa/platform-impl/ext_log_upload_strategy_by_volume.c
+++ client/client-multi/client-c/src/kaa/platform-impl/ext_log_upload_strategy_by_volume.c
@@ -19,6 +19,8 @@
  * @brief Simple sample implementation of the log upload strategy interface defined in ext_log_upload_strategy.h.
  * Makes decisions purely based on the amount of logs collected in the storage.
  */
+
+#ifndef KAA_DISABLE_FEATURE_LOGGING

 #include "../platform/platform.h"

@@ -324,3 +326,5 @@
     ((ext_log_upload_strategy_t *)strategy)->upload_retry_period = upload_retry_period;
     return KAA_ERR_NONE;
 }
+
+#endif


Update test-client to test mojito_client_view_get_sorted_items

--- examples/test-client.c
+++ examples/test-client.c
@@ -5,9 +5,20 @@
                            MojitoItem       *item,
                            gpointer          userdata)
 {
+  GList *l;
+
   g_debug ("New item: source = %s uuid = %s",
            item->source,
            item->uuid);
+
+  g_debug ("Current list looks like:");
+
+  for (l = mojito_client_view_get_sorted_items (view); l; l = l->next)
+  {
+    g_debug ("%s %s",
+             ((MojitoItem *)l->data)->source,
+             ((MojitoItem *)l->data)->uuid);
+  }
 }

 static void


fixing jenkins compile error (caused by gcc 4.8.1 not knowing #pragma GCC diagnostic ignored "-Wfloat-conversion" and #pragma GCC diagnostic error "-Wfloat-conversion")

--- NaoTHSoccer/Source/Tools/naoth_opencv.h
+++ NaoTHSoccer/Source/Tools/naoth_opencv.h
@@ -6,7 +6,9 @@
 #pragma GCC diagnostic push
 #endif
 #pragma GCC diagnostic ignored "-Wconversion"
+#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
 #pragma GCC diagnostic ignored "-Wfloat-conversion"
+#endif
 #endif
 #include <opencv2/core/core.hpp>
 #include <opencv2/imgproc/imgproc.hpp>
@@ -16,7 +18,9 @@
 #pragma GCC diagnostic push
 #endif
 #pragma GCC diagnostic error "-Wconversion"
+#if (__GNUC__ == 4 && __GNUC_MINOR__ < 8) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
 #pragma GCC diagnostic error "-Wfloat-conversion"
+#endif
 #endif

 #endif // NAOTH_OPENCV_H


regen

regen

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

--- utils/typedump/typedump.c
+++ utils/typedump/typedump.c
@@ -222,6 +222,7 @@
 	PRTYPE(struct slash_creds);
 	PRTYPE(struct slc_async_req);
 	PRTYPE(struct slc_wkdata_readdir);
+	PRTYPE(struct slcfg_local);
 	PRTYPE(struct slconn_params);
 	PRTYPE(struct slconn_thread);
 	PRTYPE(struct slctl_res_field);


write the registration values to the solv file

--- tools/repo_products.c
+++ tools/repo_products.c
@@ -312,6 +312,7 @@
         }
       break;
     case STATE_TARGET:
+      repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_TARGET, pd->content );
       if (currentproduct == baseproduct
 	  && pd->attribute
 	  && !strcmp(pd->attribute, "register.target"))
@@ -329,6 +330,7 @@
 	}
     break;
     case STATE_REGRELEASE:
+      repodata_set_str(pd->data, pd->handle, PRODUCT_REGISTER_RELEASE, pd->content );
       if (currentproduct == baseproduct
 	  && pd->attribute
 	  && !strcmp(pd->attribute, "register.release"))


Actually free the temporary pixbuf data.

--- gdk-pixbuf/gdk-pixdata.c
+++ gdk-pixbuf/gdk-pixdata.c
@@ -290,6 +290,13 @@
   return bp;
 }

+/* Used as the destroy notification function for gdk_pixbuf_new() */
+static void
+free_buffer (guchar *pixels, gpointer data)
+{
+	g_free (pixels);
+}
+
 /**
  * gdk_pixdata_from_pixbuf:
  * @pixdata: a #GdkPixdata to fill.
@@ -341,12 +348,12 @@
 					  pixbuf->width,
 					  pixbuf->height,
 					  rowstride,
-					  NULL, NULL);
+					  free_buffer, NULL);
 	  gdk_pixbuf_copy_area (pixbuf, 0, 0, pixbuf->width, pixbuf->height,
 				buf, 0, 0);
 	}
       else
-	buf = pixbuf;
+	buf = (GdkPixbuf *)pixbuf;
       pad = rowstride;
       pad = MAX (pad, 130 + n_bytes / 127);
       data = g_new (guint8, pad + n_bytes);


Minor tweaks to haswell power sequencing

- pass through the eDP VDD enable from PCH
- Bring up suspend rail after DPWROK and before RSMRST,
as indicated for deep sleep sequencing
- de-assert CPU_PGOOD on S0->S3 transition, it was
getting left enabled

BUG=chrome-os-partner:19398
BRANCH=none
TEST=successful state transition from G3 to S0 and back to G3

Change-Id: Ie711275d6121edccff60b2de08b71575d2d035b7
Signed-off-by: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51154
Reviewed-by: Aaron Durbin <af0622ab041e8b0f8e5819838dcc93898196e71f@chromium.org>

--- common/x86_power_haswell.c
+++ common/x86_power_haswell.c
@@ -390,6 +390,10 @@
 	/* Shadow signals and compare with our desired signal state. */
 	update_in_signals();

+	/* Pass through eDP VDD enable from PCH */
+	if (gpio_get_level(GPIO_PCH_EDP_VDD_EN))
+		gpio_set_level(GPIO_EC_EDP_VDD_EN, 1);
+
 	/* Wake up the task */
 	task_wake(TASK_ID_CHIPSET);
 }
@@ -502,21 +506,28 @@
 				break;
 			}

-			gpio_set_level(GPIO_SUSP_VR_EN, 1);
-			if (wait_in_signals(IN_PGOOD_PP1050)) {
-				chipset_force_shutdown();
-				state = X86_G3;
-				break;
-			}
-
 			/*
 			 * Wait 10ms after +3VALW good, since that powers
 			 * VccDSW and VccSUS.
 			 */
 			msleep(10);

-			/* Assert DPWROK, deassert RSMRST# */
+			/* Assert DPWROK */
 			gpio_set_level(GPIO_PCH_DPWROK, 1);
+			if (wait_in_signals(IN_PCH_SLP_SUSn_DEASSERTED)) {
+				chipset_force_shutdown();
+				state = X86_G3;
+				break;
+			}
+
+			gpio_set_level(GPIO_SUSP_VR_EN, 1);
+			if (wait_in_signals(IN_PGOOD_PP1050)) {
+				chipset_force_shutdown();
+				state = X86_G3;
+				break;
+			}
+
+			/* Deassert RSMRST# */
 			gpio_set_level(GPIO_PCH_RSMRST_L, 1);

 			/* Wait 5ms for SUSCLK to stabilize */
@@ -604,6 +615,7 @@

 			/* Disable +CPU_CORE */
 			gpio_set_level(GPIO_VCORE_EN, 0);
+			gpio_set_level(GPIO_CPU_PGOOD, 0);

 			/* Disable WLAN */
 			gpio_set_level(GPIO_WLAN_OFF_L, 0);


Keyboard detection was skipping ones connected via PS/2. (dm)

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

--- Programs/keyboard.h
+++ Programs/keyboard.h
@@ -25,7 +25,7 @@

 typedef enum {
   KBD_TYPE_Any = 0,
-  KBD_TYPE_PS2 = 0,
+  KBD_TYPE_PS2,
   KBD_TYPE_USB,
   KBD_TYPE_Bluetooth
 } KeyboardType;


Fix the declaration of an async alarm hanler. (dm)

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

--- Programs/scr_real.c
+++ Programs/scr_real.c
@@ -51,7 +51,7 @@
 static int gpmConnectionState = GCS_CLOSED;

 static void
-gpmResetConnection (void *data) {
+gpmResetConnection (const AsyncAlarmCallbackParameters *parameters) {
   gpmConnectionState = GCS_CLOSED;
 }


virtual mailboxes: Support negative mailbox patterns/names. This allows for example "all mailboxes, except Spam".

--- src/plugins/virtual/virtual-config.c
+++ src/plugins/virtual/virtual-config.c
@@ -96,6 +96,7 @@
 {
 	struct mail_user *user = ctx->mbox->storage->storage.ns->user;
 	struct virtual_backend_box *bbox;
+	const char *name;

 	if (*line == ' ') {
 		/* continues the previous search rule */
@@ -118,8 +119,8 @@
 	bbox->name = p_strdup(ctx->pool, line);
 	if (strchr(bbox->name, '*') != NULL ||
 	    strchr(bbox->name, '%') != NULL) {
-		bbox->glob = imap_match_init(ctx->pool, bbox->name,
-					     TRUE, ctx->sep);
+		name = bbox->name[0] == '-' ? bbox->name +1 : bbox->name;
+		bbox->glob = imap_match_init(ctx->pool, name, TRUE, ctx->sep);
 		bbox->ns = mail_namespace_find(user->namespaces, &line);
 		ctx->have_wildcards = TRUE;
 	}
@@ -129,18 +130,28 @@

 static void
 separate_wildcard_mailboxes(struct virtual_mailbox *mbox,
-			    ARRAY_TYPE(virtual_backend_box) *wildcard_boxes)
+			    ARRAY_TYPE(virtual_backend_box) *wildcard_boxes,
+			    ARRAY_TYPE(virtual_backend_box) *neg_boxes)
 {
 	struct virtual_backend_box *const *bboxes;
+	ARRAY_TYPE(virtual_backend_box) *dest;
 	unsigned int i, count;

 	bboxes = array_get_modifiable(&mbox->backend_boxes, &count);
 	t_array_init(wildcard_boxes, I_MIN(16, count));
+	t_array_init(neg_boxes, 4);
 	for (i = 0; i < count;) {
-		if (bboxes[i]->glob == NULL)
+		if (*bboxes[i]->name == '-')
+			dest = neg_boxes;
+		else if (bboxes[i]->glob != NULL)
+			dest = wildcard_boxes;
+		else {
+			dest = NULL;
 			i++;
-		else {
-			array_append(wildcard_boxes, &bboxes[i], 1);
+		}
+
+		if (dest != NULL) {
+			array_append(dest, &bboxes[i], 1);
 			array_delete(&mbox->backend_boxes, i, 1);
 			bboxes = array_get_modifiable(&mbox->backend_boxes,
 						      &count);
@@ -162,17 +173,45 @@
 	array_append(&ctx->mbox->backend_boxes, &bbox, 1);
 }

+static bool virtual_config_match(const struct mailbox_info *info,
+				 ARRAY_TYPE(virtual_backend_box) *boxes_arr,
+				 unsigned int *idx_r)
+{
+	struct virtual_backend_box *const *boxes;
+	unsigned int i, count;
+
+	boxes = array_get_modifiable(boxes_arr, &count);
+	for (i = 0; i < count; i++) {
+		if (boxes[i]->glob != NULL) {
+			/* we match only one namespace for each pattern. */
+			if (boxes[i]->ns == info->ns &&
+			    imap_match(boxes[i]->glob,
+				       info->name) == IMAP_MATCH_YES) {
+				*idx_r = i;
+				return TRUE;
+			}
+		} else {
+			i_assert(boxes[i]->name[0] == '-');
+			if (strcmp(boxes[i]->name + 1, info->name) == 0) {
+				*idx_r = i;
+				return TRUE;
+			}
+		}
+	}
+	return FALSE;
+}
+
 static int virtual_config_expand_wildcards(struct virtual_parse_context *ctx)
 {
 	struct mail_user *user = ctx->mbox->storage->storage.ns->user;
-	ARRAY_TYPE(virtual_backend_box) wildcard_boxes;
+	ARRAY_TYPE(virtual_backend_box) wildcard_boxes, neg_boxes;
 	struct mailbox_list_iterate_context *iter;
 	struct virtual_backend_box *const *wboxes;
 	const char **patterns;
 	const struct mailbox_info *info;
-	unsigned int i, count;
-
-	separate_wildcard_mailboxes(ctx->mbox, &wildcard_boxes);
+	unsigned int i, j, count;
+
+	separate_wildcard_mailboxes(ctx->mbox, &wildcard_boxes, &neg_boxes);

 	/* get patterns we want to list */
 	wboxes = array_get_modifiable(&wildcard_boxes, &count);
@@ -185,17 +224,15 @@
 					MAILBOX_LIST_ITER_VIRTUAL_NAMES |
 					MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
 	while ((info = mailbox_list_iter_next(iter)) != NULL) {
-		for (i = 0; i < count; i++) {
-			/* we match only one namespace for each pattern.
-			   skip non-selectable mailboxes (especially mbox
-			   directories) */
-			if (wboxes[i]->ns == info->ns &&
-			    (info->flags & MAILBOX_NOSELECT) == 0 &&
-			    imap_match(wboxes[i]->glob,
-				       info->name) == IMAP_MATCH_YES) {
-				virtual_config_copy_expanded(ctx, wboxes[i],
-							     info->name);
-			}
+		/* skip non-selectable mailboxes (especially mbox
+		   directories) */
+		if ((info->flags & MAILBOX_NOSELECT) != 0)
+			continue;
+
+		if (virtual_config_match(info, &wildcard_boxes, &i) &&
+		    !virtual_config_match(info, &neg_boxes, &j)) {
+			virtual_config_copy_expanded(ctx, wboxes[i],
+						     info->name);
 		}
 	}
 	for (i = 0; i < count; i++)


virtual: Allow search rule continuation lines to begin with tab as well as space.

--- src/plugins/virtual/virtual-config.c
+++ src/plugins/virtual/virtual-config.c
@@ -118,6 +118,8 @@
 			*error_r = "Search rule without a mailbox";
 			return -1;
 		}
+		while (*line == ' ' || *line == '\t') line++;
+		str_append_c(ctx->rule, ' ');
 		str_append(ctx->rule, line);
 		return 0;
 	}


tests/periph_flashpage: improve flashpage tests

-) verify correctness of data written by raw write test
-) write to really last flash page and not last - 1
-) use flashpage_addr instead of manual calculation

--- tests/periph_flashpage/main.c
+++ tests/periph_flashpage/main.c
@@ -310,7 +310,7 @@
         }
     }

-    if (flashpage_write_and_verify((int)FLASHPAGE_NUMOF - 2, page_mem) != FLASHPAGE_OK) {
+    if (flashpage_write_and_verify((int)FLASHPAGE_NUMOF - 1, page_mem) != FLASHPAGE_OK) {
         puts("error verifying the content of last page");
         return 1;
     }
@@ -336,9 +336,15 @@
     memcpy(raw_buf, "test12344321tset", 16);

     /* erase the page first */
-    flashpage_write(((int)FLASHPAGE_NUMOF - 2), NULL);
-
-    flashpage_write_raw((void*) ((int)CPU_FLASH_BASE + (int)FLASHPAGE_SIZE * ((int)FLASHPAGE_NUMOF - 2)), raw_buf, strlen(raw_buf));
+    flashpage_write(((int)FLASHPAGE_NUMOF - 1), NULL);
+
+    flashpage_write_raw(flashpage_addr((int)FLASHPAGE_NUMOF - 1), raw_buf, strlen(raw_buf));
+
+    /* verify that previous write_raw effectively wrote the desired data */
+    if (memcmp(flashpage_addr((int)FLASHPAGE_NUMOF - 1), raw_buf, strlen(raw_buf)) != 0) {
+        puts("error verifying the content of last page");
+        return 1;
+    }

     puts("wrote raw short buffer to last flash page");
     return 0;


Count should always start from zero.

Count should always start from zero.

Doesn't matter if we need to relocate or not.

Makes sense to jasper@

--- compat/linux/linux_futex.c
+++ compat/linux/linux_futex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_futex.c,v 1.8 2012/06/19 11:46:00 pirofti Exp $ */
+/* $OpenBSD: linux_futex.c,v 1.9 2012/06/19 11:47:10 pirofti Exp $ */
 /*	$NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */

 /*-
@@ -522,12 +522,10 @@
 futex_wake(struct futex *f, int n, struct futex *newf, int n2)
 {
 	struct waiting_proc *wp;
-	int count;
+	int count = 0;

 	KASSERT(newf != f);
 	MUTEX_ASSERT_LOCKED(&futex_lock);
-
-	count = newf ? 0 : 1;

 	/*
 	 * first, wake up any threads sleeping on this futex.


Bumping release version to 0.9-alpha 8.10.0

--- src/psmoveprotocol/ProtocolVersion.h
+++ src/psmoveprotocol/ProtocolVersion.h
@@ -13,7 +13,7 @@
 #define PSM_RELEASE_VERSION_MAJOR   9
 #define PSM_RELEASE_VERSION_PHASE   alpha
 #define PSM_RELEASE_VERSION_MINOR   8
-#define PSM_RELEASE_VERSION_RELEASE 9
+#define PSM_RELEASE_VERSION_RELEASE 10
 #define PSM_RELEASE_VERSION_HOTFIX  0

 /// "Product.Major-Phase Minor.Release.Hotfix"


Bluetooth: Shell: Fix l2cap-send

Bluetooth: Shell: Fix l2cap-send

bt_l2cap_chan_send does actually return the number of bytes sent.

Change-Id: I862a8519c752c6b26250a21be02a927a9326617c
Signed-off-by: Luiz Augusto von Dentz <8530c5ea66a1bdbc08f98bfcf183c8be901b5990@intel.com>

--- samples/bluetooth/shell/src/main.c
+++ samples/bluetooth/shell/src/main.c
@@ -1402,7 +1402,7 @@
 static void cmd_l2cap_send(int argc, char *argv[])
 {
 	static uint8_t buf_data[DATA_MTU] = { [0 ... (DATA_MTU - 1)] = 0xff };
-	int err, len, count = 1;
+	int ret, len, count = 1;
 	struct net_buf *buf;

 	if (argc > 1) {
@@ -1419,9 +1419,9 @@
 		}

 		memcpy(net_buf_add(buf, len), buf_data, len);
-		err = bt_l2cap_chan_send(&l2cap_chan, buf);
-		if (err) {
-			printk("Unable to send: %u\n", -err);
+		ret = bt_l2cap_chan_send(&l2cap_chan, buf);
+		if (ret < 0) {
+			printk("Unable to send: %u\n", -ret);
 			net_buf_unref(buf);
 			break;
 		}


regenerate Python-ast.c

regenerate Python-ast.c

--- Python/Python-ast.c
+++ Python/Python-ast.c
@@ -3374,13 +3374,18 @@
 obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
+        int isinstance;

         if (obj == Py_None) {
                 *out = NULL;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Module_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* body;

                 if (PyObject_HasAttrString(obj, "body")) {
@@ -3412,7 +3417,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Interactive_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* body;

                 if (PyObject_HasAttrString(obj, "body")) {
@@ -3444,7 +3453,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Expression_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty body;

                 if (PyObject_HasAttrString(obj, "body")) {
@@ -3463,7 +3476,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Suite_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* body;

                 if (PyObject_HasAttrString(obj, "body")) {
@@ -3508,6 +3525,7 @@
 obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
+        int isinstance;

         int lineno;
         int col_offset;
@@ -3540,7 +3558,11 @@
                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt");
                 return 1;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)FunctionDef_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 identifier name;
                 arguments_ty args;
                 asdl_seq* body;
@@ -3637,7 +3659,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)ClassDef_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 identifier name;
                 asdl_seq* bases;
                 asdl_seq* keywords;
@@ -3785,7 +3811,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Return_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;

                 if (PyObject_HasAttrString(obj, "value")) {
@@ -3803,7 +3833,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Delete_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* targets;

                 if (PyObject_HasAttrString(obj, "targets")) {
@@ -3835,7 +3869,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Assign_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* targets;
                 expr_ty value;

@@ -3880,7 +3918,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)AugAssign_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty target;
                 operator_ty op;
                 expr_ty value;
@@ -3925,7 +3967,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)For_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)For_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty target;
                 expr_ty iter;
                 asdl_seq* body;
@@ -4010,7 +4056,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)While_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)While_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty test;
                 asdl_seq* body;
                 asdl_seq* orelse;
@@ -4081,7 +4131,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)If_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)If_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty test;
                 asdl_seq* body;
                 asdl_seq* orelse;
@@ -4152,7 +4206,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)With_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)With_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty context_expr;
                 expr_ty optional_vars;
                 asdl_seq* body;
@@ -4210,7 +4268,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Raise_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty exc;
                 expr_ty cause;

@@ -4240,7 +4302,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)TryExcept_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)TryExcept_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* body;
                 asdl_seq* handlers;
                 asdl_seq* orelse;
@@ -4325,7 +4391,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)TryFinally_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)TryFinally_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* body;
                 asdl_seq* finalbody;

@@ -4383,7 +4453,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Assert_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty test;
                 expr_ty msg;

@@ -4414,7 +4488,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Import_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* names;

                 if (PyObject_HasAttrString(obj, "names")) {
@@ -4446,7 +4524,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)ImportFrom_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 identifier module;
                 asdl_seq* names;
                 int level;
@@ -4503,7 +4585,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Global_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* names;

                 if (PyObject_HasAttrString(obj, "names")) {
@@ -4535,7 +4621,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Nonlocal_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Nonlocal_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* names;

                 if (PyObject_HasAttrString(obj, "names")) {
@@ -4567,7 +4657,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Expr_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;

                 if (PyObject_HasAttrString(obj, "value")) {
@@ -4586,19 +4680,31 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Pass_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {

                 *out = Pass(lineno, col_offset, arena);
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Break_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {

                 *out = Break(lineno, col_offset, arena);
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Continue_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {

                 *out = Continue(lineno, col_offset, arena);
                 if (*out == NULL) goto failed;
@@ -4617,6 +4723,7 @@
 obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
+        int isinstance;

         int lineno;
         int col_offset;
@@ -4649,7 +4756,11 @@
                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr");
                 return 1;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)BoolOp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 boolop_ty op;
                 asdl_seq* values;

@@ -4694,7 +4805,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)BinOp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty left;
                 operator_ty op;
                 expr_ty right;
@@ -4739,7 +4854,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)UnaryOp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 unaryop_ty op;
                 expr_ty operand;

@@ -4771,7 +4890,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Lambda_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 arguments_ty args;
                 expr_ty body;

@@ -4803,7 +4926,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)IfExp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty test;
                 expr_ty body;
                 expr_ty orelse;
@@ -4848,7 +4975,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Dict_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* keys;
                 asdl_seq* values;

@@ -4906,7 +5037,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Set_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* elts;

                 if (PyObject_HasAttrString(obj, "elts")) {
@@ -4938,7 +5073,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)ListComp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty elt;
                 asdl_seq* generators;

@@ -4983,7 +5122,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)SetComp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty elt;
                 asdl_seq* generators;

@@ -5028,7 +5171,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)DictComp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty key;
                 expr_ty value;
                 asdl_seq* generators;
@@ -5087,7 +5234,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty elt;
                 asdl_seq* generators;

@@ -5132,7 +5283,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Yield_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;

                 if (PyObject_HasAttrString(obj, "value")) {
@@ -5150,7 +5305,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Compare_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty left;
                 asdl_int_seq* ops;
                 asdl_seq* comparators;
@@ -5222,7 +5381,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Call_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty func;
                 asdl_seq* args;
                 asdl_seq* keywords;
@@ -5318,7 +5481,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Num_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 object n;

                 if (PyObject_HasAttrString(obj, "n")) {
@@ -5337,7 +5504,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Str_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 string s;

                 if (PyObject_HasAttrString(obj, "s")) {
@@ -5356,7 +5527,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Bytes_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Bytes_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 string s;

                 if (PyObject_HasAttrString(obj, "s")) {
@@ -5375,13 +5550,21 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Ellipsis_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {

                 *out = Ellipsis(lineno, col_offset, arena);
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Attribute_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;
                 identifier attr;
                 expr_context_ty ctx;
@@ -5426,7 +5609,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Subscript_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;
                 slice_ty slice;
                 expr_context_ty ctx;
@@ -5471,7 +5658,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Starred_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Starred_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;
                 expr_context_ty ctx;

@@ -5503,7 +5694,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Name_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 identifier id;
                 expr_context_ty ctx;

@@ -5535,7 +5730,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)List_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)List_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* elts;
                 expr_context_ty ctx;

@@ -5580,7 +5779,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Tuple_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* elts;
                 expr_context_ty ctx;

@@ -5638,28 +5841,53 @@
 obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
-
-        if (PyObject_IsInstance(obj, (PyObject*)Load_type)) {
+        int isinstance;
+
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Load;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Store_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Store;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Del_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Del;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)AugLoad_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = AugLoad;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)AugStore_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = AugStore;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Param_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Param;
                 return 0;
         }
@@ -5676,13 +5904,18 @@
 obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
+        int isinstance;

         if (obj == Py_None) {
                 *out = NULL;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Slice_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty lower;
                 expr_ty upper;
                 expr_ty step;
@@ -5724,7 +5957,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)ExtSlice_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 asdl_seq* dims;

                 if (PyObject_HasAttrString(obj, "dims")) {
@@ -5756,7 +5993,11 @@
                 if (*out == NULL) goto failed;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Index_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty value;

                 if (PyObject_HasAttrString(obj, "value")) {
@@ -5788,12 +6029,21 @@
 obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
-
-        if (PyObject_IsInstance(obj, (PyObject*)And_type)) {
+        int isinstance;
+
+        isinstance = PyObject_IsInstance(obj, (PyObject *)And_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = And;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Or_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Or;
                 return 0;
         }
@@ -5810,52 +6060,101 @@
 obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
-
-        if (PyObject_IsInstance(obj, (PyObject*)Add_type)) {
+        int isinstance;
+
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Add;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Sub_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Sub;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Mult_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Mult;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Div_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Div;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Mod_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Mod;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Pow_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Pow;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)LShift_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = LShift;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)RShift_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = RShift;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)BitOr_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = BitOr;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)BitXor_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = BitXor;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)BitAnd_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = BitAnd;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)FloorDiv_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = FloorDiv;
                 return 0;
         }
@@ -5872,20 +6171,37 @@
 obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
-
-        if (PyObject_IsInstance(obj, (PyObject*)Invert_type)) {
+        int isinstance;
+
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Invert;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Not_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Not;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)UAdd_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = UAdd;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)USub_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = USub;
                 return 0;
         }
@@ -5902,44 +6218,85 @@
 obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
-
-        if (PyObject_IsInstance(obj, (PyObject*)Eq_type)) {
+        int isinstance;
+
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Eq;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)NotEq_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = NotEq;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Lt_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Lt;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)LtE_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = LtE;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Gt_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Gt;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)GtE_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = GtE;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)Is_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = Is;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)IsNot_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = IsNot;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)In_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)In_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = In;
                 return 0;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)NotIn_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 *out = NotIn;
                 return 0;
         }
@@ -6020,6 +6377,7 @@
 obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
 {
         PyObject* tmp = NULL;
+        int isinstance;

         int lineno;
         int col_offset;
@@ -6052,7 +6410,11 @@
                 PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler");
                 return 1;
         }
-        if (PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type)) {
+        isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type);
+        if (isinstance == -1) {
+                return 1;
+        }
+        if (isinstance) {
                 expr_ty type;
                 identifier name;
                 asdl_seq* body;
@@ -6629,11 +6991,15 @@
     PyObject *req_type[] = {(PyObject*)Module_type, (PyObject*)Expression_type,
                             (PyObject*)Interactive_type};
     char *req_name[] = {"Module", "Expression", "Interactive"};
+    int isinstance;
     assert(0 <= mode && mode <= 2);

     init_types();

-    if (!PyObject_IsInstance(ast, req_type[mode])) {
+    isinstance = PyObject_IsInstance(ast, req_type[mode]);
+    if (isinstance == -1)
+        return NULL;
+    if (!isinstance) {
         PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s",
                      req_name[mode], Py_TYPE(ast)->tp_name);
         return NULL;


rm unused header

rm unused header

--- c_solutions_11-15/Euler_15.c
+++ c_solutions_11-15/Euler_15.c
@@ -1,5 +1,4 @@
 #include <time.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>


Add the C coda to compilers/imcc/imcparser.h. This fixes t/codingstd/c_code_coda.t.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@15334 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/imcc/imcparser.h
+++ compilers/imcc/imcparser.h
@@ -299,4 +299,10 @@
 #endif

-
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+


Change RT reference to TT reference.

Change RT reference to TT reference.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@42678 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- compilers/imcc/reg_alloc.c
+++ compilers/imcc/reg_alloc.c
@@ -394,7 +394,7 @@
     rebuild_reglist(unit);

     /*
-     * RT #57028 - graph coloring reg allocator ignores local_branch/local_return
+     * TT #1281 - graph coloring reg allocator ignores local_branch/local_return
     if (IMCC_INFO(interp)->allocator == IMCC_VANILLA_ALLOCATOR)
     */
         vanilla_reg_alloc(interp, unit);


Something I don't remember

Something I don't remember

--- src/Frodo-core/core/video/adapter.h
+++ src/Frodo-core/core/video/adapter.h
@@ -83,6 +83,7 @@
 	VkSurfaceKHR CreateSurface(const Window* window);
 	bool IsExtensionSupported(const char* name) const;
 	uint32 IsExtensionsSupported(const char** names, uint32 num) const;
+	bool CheckImageFormat(VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* prop) const;

 	inline VkPhysicalDevice GetPhysicalDevice() const { return device; }
 	inline uint32 GetAPIVersion() const { return prop.apiVersion; }


obexd: fix not calling driver .reset when resetting session

.reset should be called in all situation that the session is reset,
including when there is a socket HUP/ERR, so that the driver has a chance
to cleanup properly.

In addiction to that this should also fix not removing files when
incomplete/aborted by checking the status when resetting the session.

--- obexd/src/obex.c
+++ obexd/src/obex.c
@@ -263,8 +263,21 @@
 	OBEX_ObjectSetRsp(obj, rsp, lastrsp);
 }

+static void os_session_mark_aborted(struct obex_session *os)
+{
+	/* the session was already cancelled/aborted or size in unknown */
+	if (os->aborted || os->size == OBJECT_SIZE_UNKNOWN)
+		return;
+
+	os->aborted = (os->size != os->offset);
+}
+
 static void os_reset_session(struct obex_session *os)
 {
+	os_session_mark_aborted(os);
+	if (os->service->reset)
+		os->service->reset(os, os->service_data);
+
 	if (os->object) {
 		os->driver->set_io_watch(os->object, NULL, NULL);
 		os->driver->close(os->object);
@@ -298,16 +311,6 @@
 	os->offset = 0;
 	os->size = OBJECT_SIZE_DELETE;
 	os->finished = 0;
-}
-
-static void os_session_mark_aborted(struct obex_session *os)
-{
-	/* the session was alredy cancelled/aborted */
-	if (os->aborted)
-		return;
-
-	os->aborted = os->size == OBJECT_SIZE_UNKNOWN ? FALSE :
-							os->size != os->offset;
 }

 static void obex_session_free(struct obex_session *os)
@@ -1087,8 +1090,6 @@
 		break;
 	case OBEX_EV_ABORT:
 		os->aborted = TRUE;
-		if (os->service->reset)
-			os->service->reset(os, os->service_data);
 		os_reset_session(os);
 		OBEX_ObjectSetRsp(obj, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS);
 		break;
@@ -1103,9 +1104,6 @@
 		case OBEX_CMD_GET:
 		case OBEX_CMD_SETPATH:
 		default:
-			os_session_mark_aborted(os);
-			if (os->service->reset)
-				os->service->reset(os, os->service_data);
 			os_reset_session(os);
 			break;
 		}


obexd: Fixes the case when serving folder listings bigger than MTU size

--- obexd/src/obex.c
+++ obexd/src/obex.c
@@ -456,6 +456,7 @@
 {
 	obex_headerdata_t hd;
 	gint32 len;
+	guint8 *ptr;

 	debug("obex_write_stream: name=%s type=%s tx_mtu=%d fd=%d",
 		os->name ? os->name : "", os->type ? os->type : "",
@@ -468,7 +469,8 @@
 		if (os->buf == NULL)
 			return -EIO;

-		len = os->size - os->offset;
+		len = MIN(os->size - os->offset, os->tx_mtu);
+		ptr = os->buf + os->offset;
 		goto add_header;
 	}

@@ -481,7 +483,12 @@
 		return -err;
 	}

+	ptr = os->buf;
+
 add_header:
+
+	hd.bs = ptr;
+
 	if (len == 0) {
 		OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
 					OBEX_FL_STREAM_DATAEND);
@@ -490,7 +497,6 @@
 		return len;
 	}

-	hd.bs = os->buf;
 	os->offset += len;

 	OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, len,


Fix Lagrangian calculations (I had a sign wrong) and terminate when little improvement is found.

--- fastlib/branches/fastlib-stl/fastlib/optimization/aug_lagrangian/aug_lagrangian_impl.h
+++ fastlib/branches/fastlib-stl/fastlib/optimization/aug_lagrangian/aug_lagrangian_impl.h
@@ -29,23 +29,29 @@
   // Choose initial lambda parameters (vector of zeros, for simplicity).
   arma::vec lambda(function_.NumConstraints());
   lambda.zeros();
-  double penalty_threshold = 0;
+  double penalty_threshold = 1; // Approximately (1 / (sigma_0 ^ 0.1)).
+
+  // Track the last objective to compare for convergence.
+  double last_objective = function_.Evaluate(coordinates);

   // First, we create an instance of the utility function class.
   AugLagrangianFunction f(function_, lambda, sigma);

   // The odd comparison allows user to pass num_iterations = 0 (i.e. no limit on
   // number of iterations).
-  for (int it = 0; it == (num_iterations - 1); it++) {
+  int it;
+  for (it = 0; it != (num_iterations - 1); it++) {
     // Use L-BFGS to optimize this function for the given lambda and sigma.
     L_BFGS<AugLagrangianFunction> lbfgs(f, num_basis_);
     if(!lbfgs.Optimize(0, coordinates)) {
-      FATAL("L-BFGS reported an error during optimization.");
+      NOTIFY("L-BFGS reported an error during optimization.");
     }

-    // Check if we are done with the entire optimization.
-    if (f.Evaluate(coordinates) < 1e-10) // arbitrary
+    // Check if we are done with the entire optimization (the threshold we are
+    // comparing with is arbitrary).
+    if (std::abs(last_objective - function_.Evaluate(coordinates)) < 1e-10)
       return true;
+    last_objective = function_.Evaluate(coordinates);

     // Assuming that the optimization has converged to a new set of coordinates,
     // we now update either lambda or sigma.  We update sigma if the penalty
@@ -56,25 +62,35 @@
     for (int i = 0; i < function_.NumConstraints(); i++)
       penalty += std::pow(function_.EvaluateConstraint(i, coordinates), 2);

+//    NOTIFY("Penalty is %lf (threshold %lf)", penalty, penalty_threshold);
     if (penalty < penalty_threshold) { // We update lambda.
       // We use the update: lambda_{k + 1} = lambda_k - sigma * c(coordinates),
       // but we have to write a loop to do this for each constraint.
       for (int i = 0; i < function_.NumConstraints(); i++)
         lambda[i] -= sigma * function_.EvaluateConstraint(i, coordinates);
+      f.lambda_ = lambda;

       // We also update the penalty threshold to be a factor of the current
       // penalty.  TODO: this factor should be a parameter (from IO).  The value
       // of 0.25 is taken from Burer and Monteiro (2002).
       penalty_threshold = 0.25 * penalty;

+//      NOTIFY("Updated lambda to ");
+//      std::cout << lambda;
+//      NOTIFY("Updated penalty threshold to %lf", penalty_threshold);
+
     } else {
       // We multiply sigma by a constant value.  TODO: this factor should be a
       // parameter (from IO).  The value of 10 is taken from Burer and Monteiro
       // (2002).
       sigma *= 10;
+      f.sigma_ = sigma;
+
+//      NOTIFY("Updated sigma to %lf", sigma);
     }
   }

+//  NOTIFY("Terminating after %d iterations", it);
   return false;
 }

@@ -92,12 +108,12 @@
 double AugLagrangian<LagrangianFunction>::AugLagrangianFunction::Evaluate(
     const arma::mat& coordinates) {
   // The augmented Lagrangian is evaluated as
-  //   f(x) - {lambda_i * c_i(x) + (sigma / 2) c_i(x)^2} for all constraints
+  //   f(x) + {-lambda_i * c_i(x) + (sigma / 2) c_i(x)^2} for all constraints
   double objective = function_.Evaluate(coordinates);

   // Now loop over constraints.
   for (int i = 0; i < function_.NumConstraints(); i++)
-    objective += (lambda_[i] * function_.EvaluateConstraint(i, coordinates)) +
+    objective += (-lambda_[i] * function_.EvaluateConstraint(i, coordinates)) +
         sigma_ * std::pow(function_.EvaluateConstraint(i, coordinates), 2) / 2;

   return objective;
@@ -107,7 +123,7 @@
 void AugLagrangian<LagrangianFunction>::AugLagrangianFunction::Gradient(
     const arma::mat& coordinates, arma::mat& gradient) {
   // The augmented Lagrangian's gradient is evaluated as
-  // f'(x) - {(lambda_i - sigma * c_i(x)) * c'_i(x)} for all constraints
+  // f'(x) + {(-lambda_i + sigma * c_i(x)) * c'_i(x)} for all constraints
   function_.Gradient(coordinates, gradient);

   arma::mat constraint_gradient; // Temporary for constraint gradients.
@@ -115,7 +131,7 @@
     function_.GradientConstraint(i, coordinates, constraint_gradient);

     // Now calculate scaling factor and add to existing gradient.
-    gradient += ((lambda_[i] - sigma_ *
+    gradient += ((-lambda_[i] + sigma_ *
         function_.EvaluateConstraint(i, coordinates)) * constraint_gradient);
   }
 }


staging: comedi: addi_eeprom: cleanup the defines

Fix the whitespace in the defines. This also fixes a couple
checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten <382ff55d8e07d1082d179e669636cd1552da4f36@visionengravers.com>
Cc: Ian Abbott <9e6ba6483b6a3e14d61f7c987e72ecb5b46122d6@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/comedi/drivers/addi-data/addi_eeprom.c
+++ drivers/staging/comedi/drivers/addi-data/addi_eeprom.c
@@ -31,9 +31,9 @@

 #define NVRAM_USER_DATA_START	0x100

-#define NVCMD_BEGIN_READ 	(0x7 << 5)	/*  nvRam begin read command */
-#define NVCMD_LOAD_LOW   	(0x4 << 5)	/*  nvRam load low command */
-#define NVCMD_LOAD_HIGH  	(0x5 << 5)	/*  nvRam load high command */
+#define NVCMD_BEGIN_READ	(0x7 << 5)	/* nvRam begin read command */
+#define NVCMD_LOAD_LOW		(0x4 << 5)	/* nvRam load low command */
+#define NVCMD_LOAD_HIGH		(0x5 << 5)	/* nvRam load high command */

 #define EE93C76_CLK_BIT		(1 << 0)
 #define EE93C76_CS_BIT		(1 << 1)
@@ -42,12 +42,12 @@
 #define EE93C76_READ_CMD	(0x0180 << 4)
 #define EE93C76_CMD_LEN		13

-#define EEPROM_DIGITALINPUT 			0
-#define EEPROM_DIGITALOUTPUT			1
-#define EEPROM_ANALOGINPUT				2
-#define EEPROM_ANALOGOUTPUT				3
-#define EEPROM_TIMER					4
-#define EEPROM_WATCHDOG					5
+#define EEPROM_DIGITALINPUT		0
+#define EEPROM_DIGITALOUTPUT		1
+#define EEPROM_ANALOGINPUT		2
+#define EEPROM_ANALOGOUTPUT		3
+#define EEPROM_TIMER			4
+#define EEPROM_WATCHDOG			5
 #define EEPROM_TIMER_WATCHDOG_COUNTER	10

 static void addi_eeprom_clk_93c76(unsigned long iobase, unsigned int val)


Now grabs every table from the distributed computation in each stage, might have to threshold this later.

--- fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h
+++ fastlib/trunk/contrib/dongryel/thesis_research/core/gnp/distributed_dualtree_dfs_dev.h
@@ -87,7 +87,7 @@
     PriorityQueueType prioritized_tasks;
     int current_computation_frontier_size = 0;
     bool success = false;
-    for(int i = 0; (!success) && i < world_->size(); i++) {
+    for(int i = 0; i < world_->size(); i++) {
       current_computation_frontier_size += computation_frontier[i].size();
       for(int j = 0; computation_frontier[i].size() > 0 &&
           j < max_num_work_to_dequeue_per_stage_; j++) {


staging: lustre: Use is_vmalloc_addr

staging: lustre: Use is_vmalloc_addr

Instead of manually checking the bounds of VMALLOC_START and
VMALLOC_END, just use is_vmalloc_addr. That's what the function
was designed for.

Signed-off-by: Laura Abbott <e7b4910f4742918f5926c991d8a2cd122ac7e295@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -529,8 +529,7 @@
 {
 	struct page *page;

-	if (vaddr >= VMALLOC_START &&
-	    vaddr < VMALLOC_END) {
+	if (is_vmalloc_addr(vaddr)) {
 		page = vmalloc_to_page ((void *)vaddr);
 		LASSERT (page != NULL);
 		return page;


Two more cases of switch(PySequence_Size()) without checking for case -1.
(Same problem as last checkin for SF bug 610610)
Need to clear the error and proceed.

Backport candidate

--- Python/exceptions.c
+++ Python/exceptions.c
@@ -424,6 +424,9 @@
     case 1:
         code = PySequence_GetItem(args, 0);
         break;
+    case -1:
+        PyErr_Clear();
+        /* Fall through */
     default:
         Py_INCREF(args);
         code = args;
@@ -528,6 +531,10 @@
 	{
 	    goto finally;
 	}
+	break;
+
+    case -1:
+	PyErr_Clear();
 	break;
     }