Add a 'real()' test for dense matrix/dense matrix subtractions ('dmatdmatsub')

--- blazetest/blazetest/mathtest/dmatdmatsub/OperationTest.h
+++ blazetest/blazetest/mathtest/dmatdmatsub/OperationTest.h
@@ -170,9 +170,10 @@
                           void testNegatedOperation  ();
    template< typename T > void testScaledOperation   ( T scalar );
                           void testTransposeOperation();
+                          void testAbsOperation      ();
                           void testConjOperation     ();
                           void testCTransOperation   ();
-                          void testAbsOperation      ();
+                          void testRealOperation     ();
                           void testEvalOperation     ();
                           void testSerialOperation   ();
                           void testSubmatrixOperation();
@@ -350,9 +351,10 @@
    testScaledOperation( 2.0 );
    testScaledOperation( DET( 2 ) );
    testTransposeOperation();
+   testAbsOperation();
    testConjOperation();
    testCTransOperation();
-   testAbsOperation();
+   testRealOperation();
    testEvalOperation();
    testSerialOperation();
    testSubmatrixOperation();
@@ -3232,6 +3234,414 @@

 //*************************************************************************************************
+/*!\brief Testing the abs dense matrix/dense matrix subtraction.
+//
+// \return void
+// \exception std::runtime_error Subtraction error detected.
+//
+// This function tests the abs matrix subtraction with plain assignment, addition assignment,
+// and subtraction assignment. In case any error resulting from the subtraction or the subsequent
+// assignment is detected, a \a std::runtime_error exception is thrown.
+*/
+template< typename MT1    // Type of the left-hand side dense matrix
+        , typename MT2 >  // Type of the right-hand side dense matrix
+void OperationTest<MT1,MT2>::testAbsOperation()
+{
+#if BLAZETEST_MATHTEST_TEST_ABS_OPERATION
+   if( BLAZETEST_MATHTEST_TEST_ABS_OPERATION > 1 )
+   {
+      //=====================================================================================
+      // Abs subtraction
+      //=====================================================================================
+
+      // Abs subtraction with the given matrices
+      {
+         test_  = "Abs subtraction with the given matrices";
+         error_ = "Failed subtraction operation";
+
+         try {
+            initResults();
+            dres_   = abs( lhs_ - rhs_ );
+            odres_  = abs( lhs_ - rhs_ );
+            sres_   = abs( lhs_ - rhs_ );
+            osres_  = abs( lhs_ - rhs_ );
+            refres_ = abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = abs( lhs_ - orhs_ );
+            odres_  = abs( lhs_ - orhs_ );
+            sres_   = abs( lhs_ - orhs_ );
+            osres_  = abs( lhs_ - orhs_ );
+            refres_ = abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   = abs( olhs_ - rhs_ );
+            odres_  = abs( olhs_ - rhs_ );
+            sres_   = abs( olhs_ - rhs_ );
+            osres_  = abs( olhs_ - rhs_ );
+            refres_ = abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = abs( olhs_ - orhs_ );
+            odres_  = abs( olhs_ - orhs_ );
+            sres_   = abs( olhs_ - orhs_ );
+            osres_  = abs( olhs_ - orhs_ );
+            refres_ = abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Abs subtraction with evaluated matrices
+      {
+         test_  = "Abs subtraction with evaluated matrices";
+         error_ = "Failed subtraction operation";
+
+         try {
+            initResults();
+            dres_   = abs( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  = abs( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   = abs( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  = abs( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = abs( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  = abs( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   = abs( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  = abs( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   = abs( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  = abs( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   = abs( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  = abs( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = abs( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  = abs( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   = abs( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  = abs( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+
+      //=====================================================================================
+      // Abs subtraction with addition assignment
+      //=====================================================================================
+
+      // Abs subtraction with addition assignment with the given matrices
+      {
+         test_  = "Abs subtraction with addition assignment with the given matrices";
+         error_ = "Failed addition assignment operation";
+
+         try {
+            initResults();
+            dres_   += abs( lhs_ - rhs_ );
+            odres_  += abs( lhs_ - rhs_ );
+            sres_   += abs( lhs_ - rhs_ );
+            osres_  += abs( lhs_ - rhs_ );
+            refres_ += abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += abs( lhs_ - orhs_ );
+            odres_  += abs( lhs_ - orhs_ );
+            sres_   += abs( lhs_ - orhs_ );
+            osres_  += abs( lhs_ - orhs_ );
+            refres_ += abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   += abs( olhs_ - rhs_ );
+            odres_  += abs( olhs_ - rhs_ );
+            sres_   += abs( olhs_ - rhs_ );
+            osres_  += abs( olhs_ - rhs_ );
+            refres_ += abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += abs( olhs_ - orhs_ );
+            odres_  += abs( olhs_ - orhs_ );
+            sres_   += abs( olhs_ - orhs_ );
+            osres_  += abs( olhs_ - orhs_ );
+            refres_ += abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Abs subtraction with addition assignment with evaluated matrices
+      {
+         test_  = "Abs subtraction with addition assignment with evaluated matrices";
+         error_ = "Failed addition assignment operation";
+
+         try {
+            initResults();
+            dres_   += abs( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  += abs( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   += abs( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  += abs( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += abs( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  += abs( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   += abs( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  += abs( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   += abs( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  += abs( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   += abs( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  += abs( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += abs( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  += abs( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   += abs( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  += abs( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+
+      //=====================================================================================
+      // Abs subtraction with subtraction assignment
+      //=====================================================================================
+
+      // Abs subtraction with subtraction assignment with the given matrices
+      {
+         test_  = "Abs subtraction with subtraction assignment with the given matrices";
+         error_ = "Failed subtraction assignment operation";
+
+         try {
+            initResults();
+            dres_   -= abs( lhs_ - rhs_ );
+            odres_  -= abs( lhs_ - rhs_ );
+            sres_   -= abs( lhs_ - rhs_ );
+            osres_  -= abs( lhs_ - rhs_ );
+            refres_ -= abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( lhs_ - orhs_ );
+            odres_  -= abs( lhs_ - orhs_ );
+            sres_   -= abs( lhs_ - orhs_ );
+            osres_  -= abs( lhs_ - orhs_ );
+            refres_ -= abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( olhs_ - rhs_ );
+            odres_  -= abs( olhs_ - rhs_ );
+            sres_   -= abs( olhs_ - rhs_ );
+            osres_  -= abs( olhs_ - rhs_ );
+            refres_ -= abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( olhs_ - orhs_ );
+            odres_  -= abs( olhs_ - orhs_ );
+            sres_   -= abs( olhs_ - orhs_ );
+            osres_  -= abs( olhs_ - orhs_ );
+            refres_ -= abs( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Abs subtraction with subtraction assignment with evaluated matrices
+      {
+         test_  = "Abs subtraction with subtraction assignment with evaluated matrices";
+         error_ = "Failed subtraction assignment operation";
+
+         try {
+            initResults();
+            dres_   -= abs( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  -= abs( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   -= abs( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  -= abs( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  -= abs( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   -= abs( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  -= abs( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  -= abs( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   -= abs( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  -= abs( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= abs( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  -= abs( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   -= abs( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  -= abs( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+   }
+#endif
+}
+//*************************************************************************************************
+
+
+//*************************************************************************************************
 /*!\brief Testing the conjugate dense matrix/dense matrix subtraction.
 //
 // \return void
@@ -3790,400 +4200,400 @@

 //*************************************************************************************************
-/*!\brief Testing the abs dense matrix/dense matrix subtraction.
+/*!\brief Testing the \a real dense matrix/dense matrix subtraction.
 //
 // \return void
 // \exception std::runtime_error Subtraction error detected.
 //
-// This function tests the abs matrix subtraction with plain assignment, addition assignment,
+// This function tests the \a real matrix subtraction with plain assignment, addition assignment,
 // and subtraction assignment. In case any error resulting from the subtraction or the subsequent
 // assignment is detected, a \a std::runtime_error exception is thrown.
 */
 template< typename MT1    // Type of the left-hand side dense matrix
         , typename MT2 >  // Type of the right-hand side dense matrix
-void OperationTest<MT1,MT2>::testAbsOperation()
+void OperationTest<MT1,MT2>::testRealOperation()
 {
-#if BLAZETEST_MATHTEST_TEST_ABS_OPERATION
-   if( BLAZETEST_MATHTEST_TEST_ABS_OPERATION > 1 )
+#if BLAZETEST_MATHTEST_TEST_REAL_OPERATION
+   if( BLAZETEST_MATHTEST_TEST_REAL_OPERATION > 1 )
    {
       //=====================================================================================
-      // Abs subtraction
-      //=====================================================================================
-
-      // Abs subtraction with the given matrices
-      {
-         test_  = "Abs subtraction with the given matrices";
+      // Real subtraction
+      //=====================================================================================
+
+      // Real subtraction with the given matrices
+      {
+         test_  = "Real subtraction with the given matrices";
          error_ = "Failed subtraction operation";

          try {
             initResults();
-            dres_   = abs( lhs_ - rhs_ );
-            odres_  = abs( lhs_ - rhs_ );
-            sres_   = abs( lhs_ - rhs_ );
-            osres_  = abs( lhs_ - rhs_ );
-            refres_ = abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   = abs( lhs_ - orhs_ );
-            odres_  = abs( lhs_ - orhs_ );
-            sres_   = abs( lhs_ - orhs_ );
-            osres_  = abs( lhs_ - orhs_ );
-            refres_ = abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   = abs( olhs_ - rhs_ );
-            odres_  = abs( olhs_ - rhs_ );
-            sres_   = abs( olhs_ - rhs_ );
-            osres_  = abs( olhs_ - rhs_ );
-            refres_ = abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   = abs( olhs_ - orhs_ );
-            odres_  = abs( olhs_ - orhs_ );
-            sres_   = abs( olhs_ - orhs_ );
-            osres_  = abs( olhs_ - orhs_ );
-            refres_ = abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,OMT2>( ex );
-         }
-
-         checkResults<OMT1,OMT2>();
-      }
-
-      // Abs subtraction with evaluated matrices
-      {
-         test_  = "Abs subtraction with evaluated matrices";
+            dres_   = real( lhs_ - rhs_ );
+            odres_  = real( lhs_ - rhs_ );
+            sres_   = real( lhs_ - rhs_ );
+            osres_  = real( lhs_ - rhs_ );
+            refres_ = real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = real( lhs_ - orhs_ );
+            odres_  = real( lhs_ - orhs_ );
+            sres_   = real( lhs_ - orhs_ );
+            osres_  = real( lhs_ - orhs_ );
+            refres_ = real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   = real( olhs_ - rhs_ );
+            odres_  = real( olhs_ - rhs_ );
+            sres_   = real( olhs_ - rhs_ );
+            osres_  = real( olhs_ - rhs_ );
+            refres_ = real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = real( olhs_ - orhs_ );
+            odres_  = real( olhs_ - orhs_ );
+            sres_   = real( olhs_ - orhs_ );
+            osres_  = real( olhs_ - orhs_ );
+            refres_ = real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Real subtraction with evaluated matrices
+      {
+         test_  = "Real subtraction with evaluated matrices";
          error_ = "Failed subtraction operation";

          try {
             initResults();
-            dres_   = abs( eval( lhs_ ) - eval( rhs_ ) );
-            odres_  = abs( eval( lhs_ ) - eval( rhs_ ) );
-            sres_   = abs( eval( lhs_ ) - eval( rhs_ ) );
-            osres_  = abs( eval( lhs_ ) - eval( rhs_ ) );
-            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   = abs( eval( lhs_ ) - eval( orhs_ ) );
-            odres_  = abs( eval( lhs_ ) - eval( orhs_ ) );
-            sres_   = abs( eval( lhs_ ) - eval( orhs_ ) );
-            osres_  = abs( eval( lhs_ ) - eval( orhs_ ) );
-            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   = abs( eval( olhs_ ) - eval( rhs_ ) );
-            odres_  = abs( eval( olhs_ ) - eval( rhs_ ) );
-            sres_   = abs( eval( olhs_ ) - eval( rhs_ ) );
-            osres_  = abs( eval( olhs_ ) - eval( rhs_ ) );
-            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   = abs( eval( olhs_ ) - eval( orhs_ ) );
-            odres_  = abs( eval( olhs_ ) - eval( orhs_ ) );
-            sres_   = abs( eval( olhs_ ) - eval( orhs_ ) );
-            osres_  = abs( eval( olhs_ ) - eval( orhs_ ) );
-            refres_ = abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,OMT2>( ex );
-         }
-
-         checkResults<OMT1,OMT2>();
-      }
-
-
-      //=====================================================================================
-      // Abs subtraction with addition assignment
-      //=====================================================================================
-
-      // Abs subtraction with addition assignment with the given matrices
-      {
-         test_  = "Abs subtraction with addition assignment with the given matrices";
+            dres_   = real( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  = real( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   = real( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  = real( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ = real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = real( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  = real( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   = real( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  = real( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ = real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   = real( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  = real( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   = real( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  = real( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ = real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   = real( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  = real( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   = real( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  = real( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ = real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+
+      //=====================================================================================
+      // Real subtraction with addition assignment
+      //=====================================================================================
+
+      // Real subtraction with addition assignment with the given matrices
+      {
+         test_  = "Real subtraction with addition assignment with the given matrices";
          error_ = "Failed addition assignment operation";

          try {
             initResults();
-            dres_   += abs( lhs_ - rhs_ );
-            odres_  += abs( lhs_ - rhs_ );
-            sres_   += abs( lhs_ - rhs_ );
-            osres_  += abs( lhs_ - rhs_ );
-            refres_ += abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   += abs( lhs_ - orhs_ );
-            odres_  += abs( lhs_ - orhs_ );
-            sres_   += abs( lhs_ - orhs_ );
-            osres_  += abs( lhs_ - orhs_ );
-            refres_ += abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   += abs( olhs_ - rhs_ );
-            odres_  += abs( olhs_ - rhs_ );
-            sres_   += abs( olhs_ - rhs_ );
-            osres_  += abs( olhs_ - rhs_ );
-            refres_ += abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   += abs( olhs_ - orhs_ );
-            odres_  += abs( olhs_ - orhs_ );
-            sres_   += abs( olhs_ - orhs_ );
-            osres_  += abs( olhs_ - orhs_ );
-            refres_ += abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,OMT2>( ex );
-         }
-
-         checkResults<OMT1,OMT2>();
-      }
-
-      // Abs subtraction with addition assignment with evaluated matrices
-      {
-         test_  = "Abs subtraction with addition assignment with evaluated matrices";
+            dres_   += real( lhs_ - rhs_ );
+            odres_  += real( lhs_ - rhs_ );
+            sres_   += real( lhs_ - rhs_ );
+            osres_  += real( lhs_ - rhs_ );
+            refres_ += real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += real( lhs_ - orhs_ );
+            odres_  += real( lhs_ - orhs_ );
+            sres_   += real( lhs_ - orhs_ );
+            osres_  += real( lhs_ - orhs_ );
+            refres_ += real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   += real( olhs_ - rhs_ );
+            odres_  += real( olhs_ - rhs_ );
+            sres_   += real( olhs_ - rhs_ );
+            osres_  += real( olhs_ - rhs_ );
+            refres_ += real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += real( olhs_ - orhs_ );
+            odres_  += real( olhs_ - orhs_ );
+            sres_   += real( olhs_ - orhs_ );
+            osres_  += real( olhs_ - orhs_ );
+            refres_ += real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Real subtraction with addition assignment with evaluated matrices
+      {
+         test_  = "Real subtraction with addition assignment with evaluated matrices";
          error_ = "Failed addition assignment operation";

          try {
             initResults();
-            dres_   += abs( eval( lhs_ ) - eval( rhs_ ) );
-            odres_  += abs( eval( lhs_ ) - eval( rhs_ ) );
-            sres_   += abs( eval( lhs_ ) - eval( rhs_ ) );
-            osres_  += abs( eval( lhs_ ) - eval( rhs_ ) );
-            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   += abs( eval( lhs_ ) - eval( orhs_ ) );
-            odres_  += abs( eval( lhs_ ) - eval( orhs_ ) );
-            sres_   += abs( eval( lhs_ ) - eval( orhs_ ) );
-            osres_  += abs( eval( lhs_ ) - eval( orhs_ ) );
-            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   += abs( eval( olhs_ ) - eval( rhs_ ) );
-            odres_  += abs( eval( olhs_ ) - eval( rhs_ ) );
-            sres_   += abs( eval( olhs_ ) - eval( rhs_ ) );
-            osres_  += abs( eval( olhs_ ) - eval( rhs_ ) );
-            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   += abs( eval( olhs_ ) - eval( orhs_ ) );
-            odres_  += abs( eval( olhs_ ) - eval( orhs_ ) );
-            sres_   += abs( eval( olhs_ ) - eval( orhs_ ) );
-            osres_  += abs( eval( olhs_ ) - eval( orhs_ ) );
-            refres_ += abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,OMT2>( ex );
-         }
-
-         checkResults<OMT1,OMT2>();
-      }
-
-
-      //=====================================================================================
-      // Abs subtraction with subtraction assignment
-      //=====================================================================================
-
-      // Abs subtraction with subtraction assignment with the given matrices
-      {
-         test_  = "Abs subtraction with subtraction assignment with the given matrices";
+            dres_   += real( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  += real( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   += real( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  += real( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ += real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += real( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  += real( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   += real( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  += real( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ += real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   += real( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  += real( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   += real( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  += real( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ += real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   += real( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  += real( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   += real( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  += real( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ += real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+
+      //=====================================================================================
+      // Real subtraction with subtraction assignment
+      //=====================================================================================
+
+      // Real subtraction with subtraction assignment with the given matrices
+      {
+         test_  = "Real subtraction with subtraction assignment with the given matrices";
          error_ = "Failed subtraction assignment operation";

          try {
             initResults();
-            dres_   -= abs( lhs_ - rhs_ );
-            odres_  -= abs( lhs_ - rhs_ );
-            sres_   -= abs( lhs_ - rhs_ );
-            osres_  -= abs( lhs_ - rhs_ );
-            refres_ -= abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( lhs_ - orhs_ );
-            odres_  -= abs( lhs_ - orhs_ );
-            sres_   -= abs( lhs_ - orhs_ );
-            osres_  -= abs( lhs_ - orhs_ );
-            refres_ -= abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( olhs_ - rhs_ );
-            odres_  -= abs( olhs_ - rhs_ );
-            sres_   -= abs( olhs_ - rhs_ );
-            osres_  -= abs( olhs_ - rhs_ );
-            refres_ -= abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( olhs_ - orhs_ );
-            odres_  -= abs( olhs_ - orhs_ );
-            sres_   -= abs( olhs_ - orhs_ );
-            osres_  -= abs( olhs_ - orhs_ );
-            refres_ -= abs( reflhs_ - refrhs_ );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,OMT2>( ex );
-         }
-
-         checkResults<OMT1,OMT2>();
-      }
-
-      // Abs subtraction with subtraction assignment with evaluated matrices
-      {
-         test_  = "Abs subtraction with subtraction assignment with evaluated matrices";
+            dres_   -= real( lhs_ - rhs_ );
+            odres_  -= real( lhs_ - rhs_ );
+            sres_   -= real( lhs_ - rhs_ );
+            osres_  -= real( lhs_ - rhs_ );
+            refres_ -= real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= real( lhs_ - orhs_ );
+            odres_  -= real( lhs_ - orhs_ );
+            sres_   -= real( lhs_ - orhs_ );
+            osres_  -= real( lhs_ - orhs_ );
+            refres_ -= real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   -= real( olhs_ - rhs_ );
+            odres_  -= real( olhs_ - rhs_ );
+            sres_   -= real( olhs_ - rhs_ );
+            osres_  -= real( olhs_ - rhs_ );
+            refres_ -= real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= real( olhs_ - orhs_ );
+            odres_  -= real( olhs_ - orhs_ );
+            sres_   -= real( olhs_ - orhs_ );
+            osres_  -= real( olhs_ - orhs_ );
+            refres_ -= real( reflhs_ - refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,OMT2>( ex );
+         }
+
+         checkResults<OMT1,OMT2>();
+      }
+
+      // Real subtraction with subtraction assignment with evaluated matrices
+      {
+         test_  = "Real subtraction with subtraction assignment with evaluated matrices";
          error_ = "Failed subtraction assignment operation";

          try {
             initResults();
-            dres_   -= abs( eval( lhs_ ) - eval( rhs_ ) );
-            odres_  -= abs( eval( lhs_ ) - eval( rhs_ ) );
-            sres_   -= abs( eval( lhs_ ) - eval( rhs_ ) );
-            osres_  -= abs( eval( lhs_ ) - eval( rhs_ ) );
-            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,MT2>( ex );
-         }
-
-         checkResults<MT1,MT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( eval( lhs_ ) - eval( orhs_ ) );
-            odres_  -= abs( eval( lhs_ ) - eval( orhs_ ) );
-            sres_   -= abs( eval( lhs_ ) - eval( orhs_ ) );
-            osres_  -= abs( eval( lhs_ ) - eval( orhs_ ) );
-            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<MT1,OMT2>( ex );
-         }
-
-         checkResults<MT1,OMT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( eval( olhs_ ) - eval( rhs_ ) );
-            odres_  -= abs( eval( olhs_ ) - eval( rhs_ ) );
-            sres_   -= abs( eval( olhs_ ) - eval( rhs_ ) );
-            osres_  -= abs( eval( olhs_ ) - eval( rhs_ ) );
-            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
-         }
-         catch( std::exception& ex ) {
-            convertException<OMT1,MT2>( ex );
-         }
-
-         checkResults<OMT1,MT2>();
-
-         try {
-            initResults();
-            dres_   -= abs( eval( olhs_ ) - eval( orhs_ ) );
-            odres_  -= abs( eval( olhs_ ) - eval( orhs_ ) );
-            sres_   -= abs( eval( olhs_ ) - eval( orhs_ ) );
-            osres_  -= abs( eval( olhs_ ) - eval( orhs_ ) );
-            refres_ -= abs( eval( reflhs_ ) - eval( refrhs_ ) );
+            dres_   -= real( eval( lhs_ ) - eval( rhs_ ) );
+            odres_  -= real( eval( lhs_ ) - eval( rhs_ ) );
+            sres_   -= real( eval( lhs_ ) - eval( rhs_ ) );
+            osres_  -= real( eval( lhs_ ) - eval( rhs_ ) );
+            refres_ -= real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,MT2>( ex );
+         }
+
+         checkResults<MT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= real( eval( lhs_ ) - eval( orhs_ ) );
+            odres_  -= real( eval( lhs_ ) - eval( orhs_ ) );
+            sres_   -= real( eval( lhs_ ) - eval( orhs_ ) );
+            osres_  -= real( eval( lhs_ ) - eval( orhs_ ) );
+            refres_ -= real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT1,OMT2>( ex );
+         }
+
+         checkResults<MT1,OMT2>();
+
+         try {
+            initResults();
+            dres_   -= real( eval( olhs_ ) - eval( rhs_ ) );
+            odres_  -= real( eval( olhs_ ) - eval( rhs_ ) );
+            sres_   -= real( eval( olhs_ ) - eval( rhs_ ) );
+            osres_  -= real( eval( olhs_ ) - eval( rhs_ ) );
+            refres_ -= real( eval( reflhs_ ) - eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<OMT1,MT2>( ex );
+         }
+
+         checkResults<OMT1,MT2>();
+
+         try {
+            initResults();
+            dres_   -= real( eval( olhs_ ) - eval( orhs_ ) );
+            odres_  -= real( eval( olhs_ ) - eval( orhs_ ) );
+            sres_   -= real( eval( olhs_ ) - eval( orhs_ ) );
+            osres_  -= real( eval( olhs_ ) - eval( orhs_ ) );
+            refres_ -= real( eval( reflhs_ ) - eval( refrhs_ ) );
          }
          catch( std::exception& ex ) {
             convertException<OMT1,OMT2>( ex );


Refine CUDA atomicAdd for FP16 by CUDA primitive methods (#37895)

* fix cuda atomicAdd for FP16

* try to fix ci

--- paddle/fluid/platform/device/gpu/gpu_primitives.h
+++ paddle/fluid/platform/device/gpu/gpu_primitives.h
@@ -101,6 +101,20 @@
   return (val & 0xFFFFu) | (static_cast<uint32_t>(high_half.x) << 16);
 }

+#if CUDA_VERSION >= 10000 && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 700
+static __device__ __forceinline__ float16 CUDAFP16ToPDFP16(__half x) {
+  return *reinterpret_cast<float16 *>(&x);
+}
+
+static __device__ __forceinline__ __half PDFP16ToCUDAFP16(float16 x) {
+  return *reinterpret_cast<__half *>(&x);
+}
+
+CUDA_ATOMIC_WRAPPER(Add, float16) {
+  return CUDAFP16ToPDFP16(
+      atomicAdd(reinterpret_cast<__half *>(address), PDFP16ToCUDAFP16(val)));
+}
+#else
 CUDA_ATOMIC_WRAPPER(Add, float16) {
   // concrete packed float16 value may exsits in lower or higher 16bits
   // of the 32bits address.
@@ -133,6 +147,7 @@
   }
 }
 #endif
+#endif

 CUDA_ATOMIC_WRAPPER(Add, complex<float>) {
   float *real = reinterpret_cast<float *>(address);


Fix code formating

Fix code formating

--- lib/haka/log.c
+++ lib/haka/log.c
@@ -332,7 +332,7 @@
 	struct logger *iter;

 	rwlock_readlock(&log_module_lock);
-	for (iter=loggers; iter; iter = list_next(iter)) {
+	for (iter = loggers; iter; iter = list_next(iter)) {
 		iter->message(iter, level, module, message);

 		remove_pass |= iter->mark_for_remove;
@@ -345,7 +345,7 @@

 	if (remove_pass) {
 		rwlock_readlock(&log_module_lock);
-		for (iter=loggers; iter; iter = list_next(iter)) {
+		for (iter = loggers; iter; iter = list_next(iter)) {
 			if (iter->mark_for_remove) {
 				rwlock_unlock(&log_module_lock);
 				remove_logger(iter);


Bug 1190248: Just initialize the |sign| field of |part| in s_mp_div(). r=rrelyea.

--- lib/freebl/mpi/mpi.c
+++ lib/freebl/mpi/mpi.c
@@ -4190,14 +4190,13 @@

   MP_SIGN(rem) = ZPOS;
   MP_SIGN(div) = ZPOS;
+  MP_SIGN(&part) = ZPOS;

   /* A working temporary for division     */
   MP_CHECKOK( mp_init_size(&t, MP_ALLOC(rem)));

   /* Normalize to optimize guessing       */
   MP_CHECKOK( s_mp_norm(rem, div, &d) );
-
-  part = *rem;

   /* Perform the division itself...woo!   */
   MP_USED(quot) = MP_ALLOC(quot);


Create digits.c

Create digits.c

Здравейте,
Аз съм Денис Росенов Велков №10 във вашия списък

error: pathspec '2015-2016/G/11/04/digits.c' did not match any file(s) known to git


Fix memory-leakage problem and no-WHERE stmt

--- sql_action.c
+++ sql_action.c
@@ -82,9 +82,14 @@
 }

 static void sql_add_tuple_to_table(table_node_t *self, tuple_t *tuple) {
-    tuple->next = self->tuple_list_head;
-    self->tuple_list_head = tuple;
-    self->tuple_num ++;
+    if (self->tuple_list_head) {
+        self->tuple_list_tail->next = tuple;
+        self->tuple_list_tail = tuple;
+    } else {
+        self->tuple_list_head = tuple;
+        self->tuple_list_tail = tuple;
+    }
+    self->tuple_num++;
 }

@@ -1051,6 +1056,7 @@
     attr_node_t *attr_nd = NULL;
     unsigned int bucket_idx = 0;
     bool is_find = false;
+    int tupleNum = table->tuple_num;
         printf("table name: %s\n", table->name);
         int i = 0;
         for (i = 0; i < table->attr_num; i++) {
@@ -1059,9 +1065,9 @@
                 printf("(P)");
         }
         printf("\n");
-        if (table->tuple_num) {
+        if (tupleNum) {
         tuple_nd = table->tuple_list_head;
-            while (tuple_nd) {
+            while (tuple_nd && tupleNum > 0) {
                 for (i = 0; i < table->attr_num; i++) {
                     bucket_idx = BKDRHash(table->attr[i]->name) % MAX_TUPLE_ATTR_HASH_SIZE;
                     attr_nd = tuple_nd->attr[bucket_idx];
@@ -1086,6 +1092,7 @@
                     }
                 }
                 tuple_nd = tuple_nd->next;
+                tupleNum--;
                 printf("\n");
             }
         }
@@ -1108,53 +1115,16 @@
         return NULL;
     }

-    if (table) {
+    if (table)
     	sql_print_table(table);
-        /*printf("table name: %s\n", table->name);
-        int i = 0;
-        for (i = 0; i < table->attr_num; i++) {
-            printf("\t%s", table->attr[i]->name);
-            if(table->attr[i]->col_attr&ATTR_PRIKEY)
-                printf("(P)");
-        }
-        printf("\n");
-        if (table->tuple_num) {
-        tuple_nd = table->tuple_list_head;
-            while (tuple_nd) {
-                for (i = 0; i < table->attr_num; i++) {
-                    bucket_idx = BKDRHash(table->attr[i]->name) % MAX_TUPLE_ATTR_HASH_SIZE;
-                    attr_nd = tuple_nd->attr[bucket_idx];
-                    while( attr_nd && attr_nd->header && attr_nd->header->name) {
-                        if (strcasecmp(attr_nd->header->name, table->attr[i]->name) == 0) {
-                            is_find = true;
-                            break;
-                        }
-                        attr_nd = attr_nd->next;
-                    }
-                    if (is_find) {
-
-                        is_find = false;
-                        if(attr_nd->header->data_type == DATA_TYPE_VARCHAR ) // TODO: may not be right
-                            printf("\t%s", attr_nd->value->varchar_value);
-                        else
-                            printf("\t%d", attr_nd->value->int_value);
-
-                    } else {
-                        printf("\tnull");
-                        printf("what?\n");
-                    }
-                }
-                tuple_nd = tuple_nd->next;
-                printf("\n");
-            }
-        }*/
-    } else {
+    else
         printf("error: can not find the table:%s\n", name);
-    }
+
     stmt_node_t *stmt = sql_stmt_act_init();
     sql_stmt_save(stmt, STMT_TYPE_SHOW_LOG, NULL);
     return stmt;
 }
+
 void sql_output_insert_result_to_file(insert_stmt_t *insr_stmt)
 {
 #ifdef SDEBUG
@@ -1604,7 +1574,7 @@
             alp->isPrintAll = true;
             alp->table_Name =sql_sel_find_tbl_name(rec, ((var_node_t*)clp->col_info)->prefix_value );
             alp->attr_Name = NULL;
-            alp->output_Name = NULL;
+            alp->output_Name = strdup(((var_node_t *)clp->col_info)->prefix_value);
         }
         else if(clp->is_aggregation){
             alp->isAggregation = ((aggregation_node_t*)clp->col_info)->type;
@@ -1612,7 +1582,6 @@
                 alp->isPrintAll = true;
                 alp->table_Name = NULL;
                 alp->attr_Name = NULL;
-
                 alp->output_Name = CALLOC_MEM(char, 10);
                 CALLOC_CHK(alp->output_Name);
                 if (((aggregation_node_t*)clp->col_info)->type == AGGR_TYPE_COUNT)
@@ -1901,7 +1870,9 @@

 cmp_eval_t *sql_get_cmp_from_table(sel_rec_t *rec, int idx)
 {
-    cmp_eval_t *cmpE = rec->cmpForTbl[idx].head;
+    cmp_eval_t *cmpE = NULL;
+    if(idx >= 0)
+        cmpE = rec->cmpForTbl[idx].head;
     return cmpE;
 }

@@ -1957,7 +1928,7 @@
                             result = (result && sql_sel_qualifier(rec, cmpEval->next, tuple));
                             break;
                         case LGC_TYPE_OR:
-                            printf("LGC_TYPE_OR\n");
+                            //printf("LGC_TYPE_OR\n");
                             break;
                         case LGC_TYPE_INVALID:
                             printf("LGC_TYPE_INVALID\n");
@@ -1974,7 +1945,7 @@
                             break;
                         case LGC_TYPE_OR:
                             result = (result || sql_sel_qualifier(rec, cmpEval->next, tuple));
-                            printf("LGC_TYPE_OR\n");
+                            //printf("LGC_TYPE_OR\n");
                             break;
                         case LGC_TYPE_INVALID:
                             printf("LGC_TYPE_INVALID\n");
@@ -2038,35 +2009,43 @@
 }
 bool sql_sel_qualifier_join(sel_rec_t *rec, cmp_eval_t *cmpEval, tuple_cnn_t *tplCnn)
 {
-    comparison_node_t *cmp = cmpEval->cmp;
-    var_node_t *cmpL = cmp->left;
-    var_node_t *cmpR = cmp->right;
     var_node_t *cmpThis  = NULL;
     tuple_t *tuplePrev = tplCnn->tuple;
     tuple_cnn_t * tplCnnThis = NULL;
     bool result = false;
     int idx = -1;
-    attr_node_t *attrPrev= tuplePrev->find_attr_vals(tuplePrev, cmpL->varchar_value);
-    if (!attrPrev) {
-        attrPrev = tuplePrev->find_attr_vals(tuplePrev, cmpR->varchar_value);
-        idx = cmpEval->cmpL_tblIdx;
-        cmpThis = cmpL;
-    } else {
-        idx = cmpEval->cmpR_tblIdx;
-        cmpThis = cmpR;
-    }
-    if (attrPrev) {
+    comparison_node_t *cmp;
+    var_node_t *cmpL = NULL;
+    var_node_t *cmpR = NULL;
+    attr_node_t *attrPrev = NULL;
+    if (cmpEval) {
+        cmp = cmpEval->cmp;
+        cmpL = cmp->left;
+        cmpR = cmp->right;
+        attrPrev= tuplePrev->find_attr_vals(tuplePrev, cmpL->varchar_value);
+        if (!attrPrev) {
+            attrPrev = tuplePrev->find_attr_vals(tuplePrev, cmpR->varchar_value);
+            idx = cmpEval->cmpL_tblIdx;
+            cmpThis = cmpL;
+        } else {
+            idx = cmpEval->cmpR_tblIdx;
+            cmpThis = cmpR;
+        }
+    }
+
+    //if (attrPrev) {
         cmp_eval_t *cmpEvalTbl = sql_get_cmp_from_table(rec, idx);
         result = (cmpEvalTbl == NULL);
-        table_node_t *table = rec->table[idx];
+        table_node_t *table = rec->table[1];
         tuple_t *tuple = table->tuple_list_head;
         bool evalTwo = ((cmpEval!=NULL)&&(cmpEvalTbl!=NULL));
         attr_node_t *attrThis = NULL;
         int i;
         int qualTupleNum = 0;
         for (i = 0; i < table->tuple_num; i++) {
-            attrThis = tuple->find_attr_vals(tuple, cmpThis->varchar_value);
-            result = result || sql_sel_qualifier(rec, cmpEvalTbl, tuple);
+            if(cmpThis)
+                attrThis = tuple->find_attr_vals(tuple, cmpThis->varchar_value);
+            result = (result || sql_sel_qualifier(rec, cmpEvalTbl, tuple));

             if (evalTwo) {
                 switch(rec->lgcOp)
@@ -2105,7 +2084,7 @@
             tuple = tuple->next;
         }
         tplCnn->nextQualNum = qualTupleNum;
-    }
+    //}
     return (tplCnn->nextRel != NULL);
 }

@@ -2157,7 +2136,8 @@
                             printf("unexpected lgc type\n");
                     }
                 } else {
-                    result = (result && sql_sel_qualifier_join(rec, cmpJoin, tplCnn));
+
+                        result = (result && sql_sel_qualifier_join(rec, cmpJoin, tplCnn));
                 }
             }
             if (result) {
@@ -2304,12 +2284,13 @@
         bool isRep = false;

         tuple_cnn_t *tupleRec = rec->head;
-        tuple_cnn_t *tupleDeep = rec->head;
+        tuple_cnn_t *tupleDeep = tupleRec;;
         while (tupleDeep) {
             if (strcasecmp(tupleDeep->table->name, tblInName) == 0){
                 break;
             }
             tupleDeep = tupleDeep->nextRel;
+            if (!tupleDeep->nextRel) break;
         }
         isRep = (tupleDeep->nextQualNum > 0);
         repNum = (tupleRec->nextQualNum > 0) ? tupleRec->nextQualNum : 1;// should be previos level node
@@ -2318,7 +2299,7 @@
             attrVal = (tupleTgt->find_attr_vals(tupleTgt, attrName))->value;
         }
         while (tupleAdd) {
-
+
             if (repNum == 0) {
                 tupleRec = tupleRec->next;
                 tupleDeep = tupleRec;
@@ -2326,6 +2307,8 @@
                     if (strcasecmp(tupleDeep->table->name, tblInName) == 0){
                         break;
                     }
+                    if (!tupleDeep->nextRel) break;
+
                     tupleDeep = tupleDeep->nextRel;
                 }
                 repNum = (tupleRec->nextQualNum > 0) ? tupleRec->nextQualNum : 1;
@@ -2385,7 +2368,8 @@

         if (sAttr->isPrintAll && sAttr->isAggregation == 0 ) {
             if (sAttr->table_Name) {
-                char *alias = sql_sel_find_alias_name(rec, sAttr->table_Name);
+                //char *alias = sql_sel_find_alias_name(rec, sAttr->table_Name);
+                char *alias = sAttr->output_Name;
                 for (int j = 0; j < rec->tableNum; j++) {
                     if (strcmp(rec->table[j]->name, sAttr->table_Name) == 0)
                         sql_sel_print_all_attr(rec, rec->table[j], alias ,tbl);
@@ -2399,10 +2383,7 @@
         } else if (sAttr->isAggregation > 0) {
             attrHdDst = sql_create_attr(sAttr->output_Name, DATA_TYPE_INT, 0);
             attrHdSrc = sql_look_for_attrHead(rec, sAttr, &tblIdx);
-            //if (sAttr->isPrintAll) {
-
-            //} else
-                sql_transl_to_tbl_traverse_for_aggr(rec, sAttr->table_Name, attrHdDst, sAttr->attr_Name, attrHdSrc, tbl, sAttr->isAggregation, sAttr->isPrintAll);
+            sql_transl_to_tbl_traverse_for_aggr(rec, sAttr->table_Name, attrHdDst, sAttr->attr_Name, attrHdSrc, tbl, sAttr->isAggregation, sAttr->isPrintAll);
             tbl->tuple_num++;
         } else {

@@ -2419,7 +2400,6 @@
         sAttr = sAttr->next;
         i++;
     }
-    tbl->tuple_num = rec->tupleNum;
 }

 sel_attr_t *sql_make_sel_attr_node(char *newName, char *tblName, char *attrName, bool isAll, aggregation_type_e isAggr)
@@ -2455,11 +2435,58 @@
     }
     rec->attr_list = sAttr;
 }
+bool sql_select_tuple_partial_free(tuple_t *tpl)
+{
+    if (!tpl) return true;
+    sql_select_tuple_partial_free(tpl->next);
+    attr_node_t *attrNdHd;
+    attr_node_t *attrNext;
+    for (int i = 0; i <MAX_TUPLE_ATTR_HASH_SIZE; i++) {
+        if (tpl->attr[i]) {
+            attrNdHd = tpl->attr[i];
+            while (attrNdHd) {
+                attrNext = attrNdHd->next;
+                free(attrNdHd);
+                attrNdHd = attrNext;
+            }
+        }
+    }
+    return false;
+}
+bool sql_select_tuple_all_free(tuple_t *tpl)
+{
+    if (!tpl) return true;
+    sql_select_tuple_all_free(tpl->next);
+    attr_node_t *attrNdHd;
+    attr_node_t *attrNext;
+    for (int i = 0; i <MAX_TUPLE_ATTR_HASH_SIZE; i++) {
+        if (tpl->attr[i]) {
+            attrNdHd = tpl->attr[i];
+            while (attrNdHd) {
+                attrNext = attrNdHd->next;
+                free(attrNdHd->value);
+                free(attrNdHd);
+                attrNdHd = attrNext;
+            }
+        }
+    }
+    return false;
+}
+void sql_select_vrt_table_free(sel_rec_t *rec, table_node_t *tbl)
+{
+    sql_select_tuple_partial_free(tbl->tuple_list_head);
+    for (int i = 0; i < tbl->attr_num; i++) {
+        if (tbl->attr[i]) {
+            free(tbl->attr[i]->name);
+            free(tbl->attr[i]);
+        }
+    }
+    free(tbl->name);
+}

 bool sql_select_stmt_handle(select_stmt_t *selStmt)
 {
     /*Refered to sql_show_table_content() */
-
     /*Decode "From" instruction to get the table to use and construct an aliases-table.*/
     /*Decode "Where" instruction*/
     /*Decode "Select" instruction*/
@@ -2468,11 +2495,10 @@
     sel_rec_t rec;
     memset(&rec, 0, sizeof(sel_rec_t));
     memset(&tbl, 0, sizeof(table_node_t));
+    rec.lgcOp = LGC_TYPE_INVALID;
     // collect table in rec
     sql_sel_collect_table(&rec, selStmt->select_table_list);
     sql_sel_collect_attr(&rec, selStmt->select_col_list);
-    //sql_sel_temp_select_list_collect(&rec);
-    rec.lgcOp = LGC_TYPE_INVALID;
     sql_sel_collect_qual(&rec, selStmt->select_qualifier, LGC_TYPE_INVALID);
     sql_sel_stmt_qual_tuple(&rec);
     tuple_t *tupleHead = sql_sel_create_qual_tuple_for_output(rec.tupleNum);
@@ -2480,40 +2506,11 @@
     tbl.tuple_list_head = tupleHead;
     sql_transl_to_tbl(&rec, &tbl);
     sql_print_table(&tbl);
-    // collect where clause and chk ambiguity
-    stmt_node_t *stmt = sql_stmt_act_init();
-    sql_stmt_save(stmt, STMT_TYPE_TEST_SEL, NULL);
-    return stmt;
+    sql_select_vrt_table_free(&rec, &tbl);
     return true;
-}//0401//0405
-
-stmt_node_t *sql_sel_stmt_hdl(select_stmt_t *selStmt)
-{
-    table_node_t tbl;
-    sel_rec_t rec;
-    memset(&rec, 0, sizeof(sel_rec_t));
-    memset(&tbl, 0, sizeof(table_node_t));
-    // collect table in rec
-    sql_sel_collect_table(&rec, selStmt->select_table_list);
-    sql_sel_temp_select_list_collect(&rec);
-    rec.lgcOp = LGC_TYPE_INVALID;
-    sql_sel_collect_qual(&rec, selStmt->select_qualifier, LGC_TYPE_INVALID);
-    sql_sel_stmt_qual_tuple(&rec);
-    tuple_t *tupleHead = sql_sel_create_qual_tuple_for_output(rec.tupleNum);
-
-    //tbl.add_tuple(&tbl, tupleHead);
-    tbl.tuple_list_head = tupleHead;
-    sql_transl_to_tbl(&rec, &tbl);
-    sql_print_table(&tbl);
-    // collect where clause and chk ambiguity
-    stmt_node_t *stmt = sql_stmt_act_init();
-    sql_stmt_save(stmt, STMT_TYPE_TEST_SEL, NULL);
-    return stmt;
-
-}
-
-
-/******/
+}
+
+

 stmt_node_t *sql_import_file(char *name)
@@ -2535,6 +2532,7 @@
     sql_stmt_save(stmt, STMT_TYPE_IMPORT_FILE, NULL);
     return stmt;
 }
+
 expr_node_t *sql_expr_aggregation_node_create(aggregation_type_e type, bool is_star, expr_node_t *expr_node)
 {
     /*Error condition*/
@@ -2576,6 +2574,30 @@
 #define MAX_TARGET_NUM 1
 #define MAX_TABLE_NUM 2

+stmt_node_t *sql_sel_stmt_hdl(select_stmt_t *selStmt)
+{
+    table_node_t tbl;
+    sel_rec_t rec;
+    memset(&rec, 0, sizeof(sel_rec_t));
+    memset(&tbl, 0, sizeof(table_node_t));
+    // collect table in rec
+    sql_sel_collect_table(&rec, selStmt->select_table_list);
+    sql_sel_temp_select_list_collect(&rec);
+    rec.lgcOp = LGC_TYPE_INVALID;
+    sql_sel_collect_qual(&rec, selStmt->select_qualifier, LGC_TYPE_INVALID);
+    sql_sel_stmt_qual_tuple(&rec);
+    tuple_t *tupleHead = sql_sel_create_qual_tuple_for_output(rec.tupleNum);
+
+    //tbl.add_tuple(&tbl, tupleHead);
+    tbl.tuple_list_head = tupleHead;
+    sql_transl_to_tbl(&rec, &tbl);
+    sql_print_table(&tbl);
+    // collect where clause and chk ambiguity
+    stmt_node_t *stmt = sql_stmt_act_init();
+    sql_stmt_save(stmt, STMT_TYPE_TEST_SEL, NULL);
+    return stmt;
+
+}
 comparison_node_t *sql_test_make_cmp_node(cmp_type_e cmp_type,
                                           data_type_e ltype,
                                           char *lPfxVal,


Added a todo.

Added a todo.

--- contrib/IECoreGL/include/IECoreGL/CameraController.h
+++ contrib/IECoreGL/include/IECoreGL/CameraController.h
@@ -45,6 +45,8 @@

 IE_CORE_FORWARDDECLARE( Camera )

+/// \todo Make this work on IECore::Camera instead, and put it in IECore
+/// rather than IECoreGL.
 class CameraController : public IECore::RefCounted
 {


try more

try more

--- mount_slash/pgcache.c
+++ mount_slash/pgcache.c
@@ -421,8 +421,7 @@
 		pll_add(&bmpc->bmpc_lru, e);

 		BMPCE_ULOCK(e);
-#if 0
-		if (bmpce_pool->ppm_nfree < 16) {
+		if (bmpce_pool->ppm_nfree < 3) {
 			OPSTAT_INCR("msl.bmpce-nfree-reap");
 #if 0
 			bmpce_reaper(bmpce_pool);
@@ -431,7 +430,6 @@
 			psc_waitq_wakeone(&sl_freap_waitq);
 #endif
 		}
-#endif
 		return;
 	}


declarations

declarations

--- mount_slash/pgcache.h
+++ mount_slash/pgcache.h
@@ -308,7 +308,9 @@
 extern struct psc_poolmgr	*bmpce_pool;
 extern struct psc_poolmgr	*bwc_pool;

-extern struct timespec		msl_bflush_maxage;
+extern struct timespec		 msl_bflush_maxage;
+extern struct psc_listcache	 msl_idle_pages;
+extern struct psc_listcache	 msl_readahead_pages;

 static __inline void
 bmpc_init(struct bmap_pagecache *bmpc)


add API for passing CSVCF_NONBLOCK

add API for passing CSVCF_NONBLOCK

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

--- mount_slash/rpc_cli.h
+++ mount_slash/rpc_cli.h
@@ -32,8 +32,8 @@
 #define SRCM_REPSZ	512
 #define SRCM_SVCNAME	"msrcm"

-#define slc_geticsvcx(resm, exp)						\
-	sl_csvc_get(&(resm)->resm_csvc, 0, (exp), (resm)->resm_nid,		\
+#define slc_geticsvcxf(resm, fl, exp)						\
+	sl_csvc_get(&(resm)->resm_csvc, (fl), (exp), (resm)->resm_nid,		\
 	    SRIC_REQ_PORTAL, SRIC_REP_PORTAL, SRIC_MAGIC, SRIC_VERSION,		\
 	    &resm2rmci(resm)->rmci_lock, &resm2rmci(resm)->rmci_waitq,		\
 	    SLCONNT_IOD, NULL)
@@ -44,7 +44,9 @@
 	    &resm2rmci(resm)->rmci_lock, &resm2rmci(resm)->rmci_waitq,		\
 	    SLCONNT_MDS, NULL)

-#define slc_geticsvc(resm)		slc_geticsvcx((resm), NULL)
+#define slc_geticsvc(resm)		slc_geticsvcxf((resm), 0, NULL)
+#define slc_geticsvcx(resm, exp)	slc_geticsvcxf((resm), 0, (exp))
+#define slc_geticsvc_nb(resm)		slc_geticsvcxf((resm), CSVCF_NONBLOCK, NULL)
 #define slc_getmcsvc(resm)		slc_getmcsvcx((resm), NULL)

 void	slc_rpc_initsvc(void);


fix stupid crash!

fix stupid crash!

--- mount_slash/usermap.c
+++ mount_slash/usermap.c
@@ -213,7 +213,7 @@
 		goto malformed;

 	DYNARRAY_FOREACH(p, n, &uids) {
-		gm = psc_hashtbl_search(&msl_gidmap_ext, p);
+		gm = psc_hashtbl_search(&msl_gidmap_ext, &p);
 		if (!gm) {
 			gm = PSCALLOC(sizeof(*gm));
 			psc_hashent_init(&msl_gidmap_ext, gm);


make folly:make_unique support customized deleter

Summary: just follow the same template arguments as unique_ptr

Test Plan: compile

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D825025

--- folly/Memory.h
+++ folly/Memory.h
@@ -34,11 +34,12 @@
  * we have std::make_unique().
  *
  * @author Louis Brandy (ldbrandy@fb.com)
- */
-
-template<typename T, typename... Args>
-std::unique_ptr<T> make_unique(Args&&... args) {
-  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+ * @author Xu Ning (xning@fb.com)
+ */
+
+template<typename T, typename Dp = std::default_delete<T>, typename... Args>
+std::unique_ptr<T, Dp> make_unique(Args&&... args) {
+  return std::unique_ptr<T, Dp>(new T(std::forward<Args>(args)...));
 }

 /**


make usleep time in scheduler unsigned.

make usleep time in scheduler unsigned.

--- schedule/schedule_do.c
+++ schedule/schedule_do.c
@@ -37,7 +37,8 @@

 void *schedule_do(void *nothing)
 {
-    int i = 0, utime = SCHEDULER_TIMING, res;
+    int i = 0, res;
+    unsigned utime = SCHEDULER_TIMING;
     double now;
 do {
     // Fake waiting. Break the while loop to achieve fair kernel (re)scheduling and fair CPU loads.


updated flag functions

updated flag functions

--- StateOS/kernel/inc/osflag.h
+++ StateOS/kernel/inc/osflag.h
@@ -427,16 +427,16 @@
 	 Flag( const unsigned _init = 0 ): __flg _FLG_INIT(_init) {}
 	~Flag( void ) { assert(__flg::queue == nullptr); }

-	void     kill     ( void )                                          {        flg_kill     (this);                        }
-	unsigned waitFor  ( unsigned _flags, unsigned _mode, cnt_t _delay ) { return flg_waitFor  (this, _flags, _mode, _delay); }
-	unsigned waitUntil( unsigned _flags, unsigned _mode, cnt_t _time )  { return flg_waitUntil(this, _flags, _mode, _time);  }
-	unsigned wait     ( unsigned _flags, unsigned _mode = flgAll )      { return flg_wait     (this, _flags, _mode);         }
-	unsigned take     ( unsigned _flags, unsigned _mode = flgAll )      { return flg_take     (this, _flags, _mode);         }
-	unsigned takeISR  ( unsigned _flags, unsigned _mode = flgAll )      { return flg_takeISR  (this, _flags, _mode);         }
-	unsigned give     ( unsigned _flags )                               { return flg_give     (this, _flags);                }
-	unsigned giveISR  ( unsigned _flags )                               { return flg_giveISR  (this, _flags);                }
-	unsigned clear    ( unsigned _flags )                               { return flg_clear    (this, _flags);                }
-	unsigned clearISR ( unsigned _flags )                               { return flg_clearISR (this, _flags);                }
+	void     kill     ( void )                                      {        flg_kill     (this);                        }
+	unsigned waitFor  ( unsigned _flags, char _mode, cnt_t _delay ) { return flg_waitFor  (this, _flags, _mode, _delay); }
+	unsigned waitUntil( unsigned _flags, char _mode, cnt_t _time )  { return flg_waitUntil(this, _flags, _mode, _time);  }
+	unsigned wait     ( unsigned _flags, char _mode = flgAll )      { return flg_wait     (this, _flags, _mode);         }
+	unsigned take     ( unsigned _flags, char _mode = flgAll )      { return flg_take     (this, _flags, _mode);         }
+	unsigned takeISR  ( unsigned _flags, char _mode = flgAll )      { return flg_takeISR  (this, _flags, _mode);         }
+	unsigned give     ( unsigned _flags )                           { return flg_give     (this, _flags);                }
+	unsigned giveISR  ( unsigned _flags )                           { return flg_giveISR  (this, _flags);                }
+	unsigned clear    ( unsigned _flags )                           { return flg_clear    (this, _flags);                }
+	unsigned clearISR ( unsigned _flags )                           { return flg_clearISR (this, _flags);                }
 };

 #endif//__cplusplus


sb6.lib, support win32 console exe

sb6.lib, support win32 console exe

--- 3rdparty/sb6/include/sb6.h
+++ 3rdparty/sb6/include/sb6.h
@@ -326,6 +326,7 @@
 };

 #if defined _WIN32
+#if defined(_WINDOWS)
 #define DECLARE_MAIN(a)                             \
 sb6::application *app = 0;                          \
 int CALLBACK WinMain(HINSTANCE hInstance,           \
@@ -338,6 +339,16 @@
     delete app;                                     \
     return 0;                                       \
 }
+#else
+#define DECLARE_MAIN(a)                             \
+int main(int argc, const char ** argv)              \
+{                                                   \
+    a *app = new a;                                 \
+    app->run(app);                                  \
+    delete app;                                     \
+    return 0;                                       \
+}
+#endif
 #elif defined _LINUX || defined __APPLE__
 #define DECLARE_MAIN(a)                             \
 int main(int argc, const char ** argv)              \


Change functional static variable to Global variable. No STATIC modifier is recommended though it is defined in Base.h. It is for consistency.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@6314 6f19259b-4bc3-4df7-8a09-765794883524

--- Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
+++ Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
@@ -21,6 +21,8 @@
 **/

 #include "MiscSubclassDriver.h"
+
+BOOLEAN  mDone = FALSE;

 //
 //
@@ -69,8 +71,6 @@
       LogRecordData was NULL.
 --*/
 {
-  STATIC BOOLEAN  Done = FALSE;
-
   //
   // First check for invalid parameters.
   //
@@ -86,7 +86,7 @@
   //
   // Is this the first time through this function?
   //
-  if (!Done) {
+  if (!mDone) {
     //
     // Yes, this is the first time.  Inspect/Change the contents of the
     // RecordData structure.
@@ -100,19 +100,19 @@
     //
     // ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemWakeupType = %%TBD
     //
-    // Set Done flag to TRUE for next pass through this function.
+    // Set mDone flag to TRUE for next pass through this function.
     // Set *LogRecordData to TRUE so data will get logged to Data Hub.
     //
-    Done            = TRUE;
+    mDone            = TRUE;
     *LogRecordData  = TRUE;
   } else {
     //
-    // No, this is the second time.  Reset the state of the Done flag
+    // No, this is the second time.  Reset the state of the mDone flag
     // to FALSE and tell the data logger that there is no more data
     // to be logged for this record type.  If any memory allocations
     // were made by earlier passes, they must be released now.
     //
-    Done            = FALSE;
+    mDone            = FALSE;
     *LogRecordData  = FALSE;
   }


TOP_SCREENx pointer type cast fix

TOP_SCREENx pointer type cast fix

--- rxtools/source/lib/draw.c
+++ rxtools/source/lib/draw.c
@@ -187,8 +187,8 @@
 void SplashScreen(){
 	unsigned *Top = (unsigned *)GetFilePack(TOP_PIC);
 	for(int i = 0; i < SCREEN_SIZE >> 4; i++){
-		*(TOP_SCREEN + i) = Top[i];
+		*(unsigned *)(TOP_SCREEN + i) = Top[i];
         if(TOP_SCREEN2)
-            *(TOP_SCREEN2 + i) = Top[i];
+            *(unsigned *)(TOP_SCREEN2 + i) = Top[i];
 	}
 }


h264la: use == operator for mfxPluginUID comparison

--- _studio/mfx_lib/plugin/include/mfx_h264la_plugin.h
+++ _studio/mfx_lib/plugin/include/mfx_h264la_plugin.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 Intel Corporation
+// Copyright (c) 2017-2019 Intel Corporation
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -29,6 +29,7 @@
 #include "mfxplugin++.h"
 #include "mfxvideo++int.h"
 #include "mfxenc.h"
+#include "mfx_utils.h"

 #if defined( AS_H264LA_PLUGIN )
@@ -82,7 +83,7 @@
         return new MFXH264LAPlugin(false);
     }
     static mfxStatus CreateByDispatcher(mfxPluginUID guid, mfxPlugin* mfxPlg) {
-        if (memcmp(& guid , &MFX_PLUGINID_H264LA_HW, sizeof(mfxPluginUID))) {
+        if (guid != MFX_PLUGINID_H264LA_HW) {
             return MFX_ERR_NOT_FOUND;
         }
         MFXH264LAPlugin* tmp_pplg = 0;


Fixing PR #10

Fixing PR #10

--- SYMPHONY/src/Master/master_prep_base.c
+++ SYMPHONY/src/Master/master_prep_base.c
@@ -4113,6 +4113,12 @@
    //   char obj_sense = env->mip->obj_sense;

    if (mip->mip_inf){
+      FREE(mip->mip_inf->c_ind);
+      FREE(mip->mip_inf->c_val);
+      FREE(mip->mip_inf->c_beg);
+      FREE(mip->mip_inf->c_sense);
+      FREE(mip->mip_inf->c_rhs);
+      FREE(mip->mip_inf->c_tmp);
       FREE(mip->mip_inf->rows);
       FREE(mip->mip_inf->cols);
       FREE(mip->mip_inf);


service data allows both types of UUIDs

service data allows both types of UUIDs

--- features/FEATURE_BLE/ble/gap/AdvertisingDataBuilder.h
+++ features/FEATURE_BLE/ble/gap/AdvertisingDataBuilder.h
@@ -125,6 +125,16 @@
          * Service Data.
          */
         SERVICE_DATA = 0x16,
+
+        /**
+         * Service Data.
+         */
+        SERVICE_DATA_16BIT_ID = 0x16,
+
+        /**
+         * Service Data.
+         */
+        SERVICE_DATA_128BIT_ID = 0x21,

         /**
          * Appearance, refer to AdvertisingData::Appearance_t.
@@ -874,26 +884,34 @@
             return BLE_ERROR_INVALID_PARAM;
         }

+        adv_data_type_t short_type = adv_data_type_t::SERVICE_DATA_16BIT_ID;
+        adv_data_type_t long_type = adv_data_type_t::SERVICE_DATA_128BIT_ID;
+
         size_t total_size = data.size() + service.getLen() + 2;
-        size_t old_size = getFieldSize(adv_data_type_t::SERVICE_DATA);
+        size_t old_size = getFieldSize(
+            (service.shortOrLong() == UUID::UUID_TYPE_SHORT) ? short_type : long_type
+        );

         /* if we can't fit the new data do not proceed */
         if (total_size > data.size() - (_payload_length - old_size)) {
             return BLE_ERROR_BUFFER_OVERFLOW;
         }

-        if (old_size) {
-            removeData(adv_data_type_t::SERVICE_DATA);
-        }
-
-        ble_error_t status1 = addData(
-            adv_data_type_t::SERVICE_DATA,
-            mbed::make_Span(service.getBaseUUID(), service.getLen())
+        /* this will insert only the UUID (and remove old data) */
+        ble_error_t status = setUUIDData(
+            mbed::make_Span(&service, 1),
+            short_type,
+            long_type
         );

-        ble_error_t status2 = appendData(adv_data_type_t::SERVICE_DATA, data);
-
-        if (status1 != BLE_ERROR_NONE || status2 != BLE_ERROR_NONE) {
+        if (status != BLE_ERROR_NONE) {
+            /* we already checked for size so this must not happen */
+            return BLE_ERROR_INTERNAL_STACK_FAILURE;
+        }
+
+        status = appendData(adv_data_type_t::SERVICE_DATA, data);
+
+        if (status != BLE_ERROR_NONE) {
             return BLE_ERROR_INTERNAL_STACK_FAILURE;
         }


store the taps as unsigned longs, rather than 1<<x notation


clarify source of log message.

clarify source of log message.

Having one print not two increases performance, too.

--- opencog/learning/feature-selection/scorers/mutual_info.h
+++ opencog/learning/feature-selection/scorers/mutual_info.h
@@ -116,10 +116,9 @@
     double operator()(const FeatureSet& fs) const
     {
         double MI = mutualInformation(ctable, fs);
-        logger().fine("MI = %e", MI);
         // double confidence = usize / (usize + confi*fs.size());
         double confidence = usize / (usize + exp(-confi*fs.size()));
-        logger().fine("confidence = %e", confidence);
+        logger().fine("MICScorerCTable MI = %g, confidence = %g", MI, confidence);
         return MI * confidence;
     }


Supressed coverity warnings for intentional NULL passing to ip_reass_dequeue_datagram

--- features/lwipstack/lwip/src/core/ipv4/lwip_ip4_frag.c
+++ features/lwipstack/lwip/src/core/ipv4/lwip_ip4_frag.c
@@ -206,9 +206,8 @@
     pbuf_free(pcur);
   }
   /* Then, unchain the struct ip_reassdata from the list and free it. */
-  if (prev != NULL) {
-    ip_reass_dequeue_datagram(ipr, prev);
-  }
+  /* coverity [FORWARD_NULL]*/
+  ip_reass_dequeue_datagram(ipr, prev);
   LWIP_ASSERT("ip_reass_pbufcount >= pbufs_freed", ip_reass_pbufcount >= pbufs_freed);
   ip_reass_pbufcount = (u16_t)(ip_reass_pbufcount - pbufs_freed);

@@ -662,9 +661,8 @@
     }

     /* release the sources allocate for the fragment queue entry */
-    if (ipr_prev != NULL) {
-      ip_reass_dequeue_datagram(ipr, ipr_prev);
-    }
+    /* coverity [FORWARD_NULL]*/
+    ip_reass_dequeue_datagram(ipr, ipr_prev);
     /* and adjust the number of pbufs currently queued for reassembly. */
     clen = pbuf_clen(p);
     LWIP_ASSERT("ip_reass_pbufcount >= clen", ip_reass_pbufcount >= clen);


Quick fix for section limits not being relocated.  This has always been
broken for gdb -k, but the section limits weren't used much in previous
versions of gdb in FreeBSD.  Now they are used for backtracing when full
symbols aren't available, and in some other new cases.

This should be fixed properly by someone who knows bfd.

This should be fixed in 2.2.

--- contrib/gdb/gdb/objfiles.c
+++ contrib/gdb/gdb/objfiles.c
@@ -83,6 +83,12 @@
   section.objfile = objfile;
   section.the_bfd_section = asect;
   section.addr = bfd_section_vma (abfd, asect);
+#ifdef __FreeBSD__
+  /* XXX perhaps this should be in bfd_section_vma (), but it wouldn't
+     even compile there, since a bfd pointer isn't actually passed in
+     all invocations of bfd_section_vma ().  */
+  section.addr += bfd_get_start_address (abfd);
+#endif
   section.endaddr = section.addr + bfd_section_size (abfd, asect);
   obstack_grow (&objfile->psymbol_obstack, (char *) &section, sizeof(section));
   objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1);


make etext test look like sheap one

make etext test look like sheap one

--- test_etext.c
+++ test_etext.c
@@ -2,9 +2,10 @@

 #include <shmem.h>

-#define SIZE 10000
-static int source[SIZE];
-static int target[SIZE];
+#define SIZE 100
+
+static int in[SIZE];
+static int out[SIZE];

 int main(void)
 {
@@ -12,29 +13,37 @@
     int mype = shmem_my_pe();
     int npes = shmem_n_pes();

-    for (int i=0; i<SIZE; i++)
-        source[i] = 1+mype;
+    int source = 0;
+    int target = (mype+1)%npes;

     for (int i=0; i<SIZE; i++)
-        target[i] = -(1+mype);
+        in [i] = 1+mype;
+
+    for (int i=0; i<SIZE; i++)
+        out[i] = -(1+mype);

     shmem_barrier_all();

-    printf("source = %p \n", source);
-    printf("target = %p \n", target);
-    printf("source[0] = %d \n", source[0]);
-    printf("target[0] = %d \n", target[0]);
+    if (mype==source) {
+        printf("in  = %p \n", in );
+        printf("out = %p \n", out);

-    int them = (mype+1)%npes;
-    printf("before shmem_int_put \n");
-    shmem_int_put(target, source, (size_t)SIZE, them);
+        printf("before shmem_int_put \n");
+        shmem_int_put(out, in , (size_t)SIZE, target);
+    }
+
     printf("before shmem_barrier_all \n");
     shmem_barrier_all();
-    them = (mype>0 ? mype-1 : npes-1);
-    for (int i=0; i<SIZE; i++)
-        if (target[i] != them)
-            printf("PE %d, element %d: correct = %d, got %d \n", mype, i, them, target[i]);

-    printf("%d: test finished \n", mype);
+    if (mype==target) {
+        for (int i=0; i<SIZE; i++)
+            if (out[i] != source)
+                printf("%d: element %d: correct = %d, got %d \n", mype, i, source, out[i]);
+    }
+
+    printf("before shmem_barrier_all \n");
+    shmem_barrier_all();
+
+    printf("test finished \n");
     return 0;
 }


Always create backup when widening, not just for memory-mapped files. This fixes an occasional bug where the server complains during starup about the failure to rename the dsnapshots bat.

--- gdk/gdk_heap.c
+++ gdk/gdk_heap.c
@@ -412,12 +412,15 @@
 	 * indicated by the "free" pointer */
 	n = (copyall ? c->heap.size : c->heap.free) >> c->shift;

-	/* for memory mapped files, create a backup copy before widening
+	/* Create a backup copy before widening.
 	 *
-	 * this solves a problem that we don't control what's in the
-	 * actual file until the next commit happens, so a crash might
-	 * otherwise leave the file (and the database) in an
-	 * inconsistent state
+	 * If the file is memory-mapped, this solves a problem that we
+	 * don't control what's in the actual file until the next
+	 * commit happens, so a crash might otherwise leave the file
+	 * (and the database) in an inconsistent state.  If, on the
+	 * other hand, the heap is allocated, it may happen that later
+	 * on the heap is extended and converted into a memory-mapped
+	 * file.  Then the same problem arises.
 	 *
 	 * also see do_backup in gdk_bbp.c */
 	filename = strrchr(c->heap.filename, DIR_SEP);
@@ -426,9 +429,11 @@
 	else
 		filename++;
 	bid = strtol(filename, NULL, 8);
-	if (c->heap.storage == STORE_MMAP &&
-	    (BBP_status(bid) & (BBPEXISTING|BBPDELETED)) &&
-	    !file_exists(c->heap.farmid, BAKDIR, filename, NULL)) {
+	if ((BBP_status(bid) & (BBPEXISTING|BBPDELETED)) &&
+	    !file_exists(c->heap.farmid, BAKDIR, filename, NULL) &&
+	    (c->heap.storage != STORE_MEM ||
+	     GDKmove(c->heap.farmid, BATDIR, c->heap.filename, NULL,
+		     BAKDIR, filename, NULL) != GDK_SUCCEED)) {
 		int fd;
 		ssize_t ret = 0;
 		size_t size = n << c->shift;


gnrc_uhcp: disable router advertisements on upstream interface

--- sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c
+++ sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c
@@ -43,6 +43,15 @@
             gnrc_netapi_set(dev, NETOPT_IPV6_ADDR, 64 << 8, &addr, sizeof(addr));
             ipv6_addr_from_str(&addr, "fe80::1");
             gnrc_ipv6_nib_ft_add(&defroute, IPV6_ADDR_BIT_LEN, &addr, dev, 0);
+
+            /* Disable router advertisements on upstream interface. With this, the border
+             * router
+             * 1. Does not confuse the upstream router to add the border router to its
+             *    default router list and
+             * 2. Solicits upstream Router Advertisements quicker to auto-configure its
+             *    upstream global address.
+             */
+            gnrc_ipv6_nib_change_rtr_adv_iface(netif, false);
         }
         else if ((!gnrc_wireless_interface) && (is_wired != 1)) {
             gnrc_wireless_interface = dev;


get rid of the horror that was the ARC_FW_MSG macro

--- dev/pci/arc.c
+++ dev/pci/arc.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: arc.c,v 1.31 2006/08/20 02:20:04 dlg Exp $ */
+/*	$OpenBSD: arc.c,v 1.32 2006/08/20 02:21:26 dlg Exp $ */

 /*
  * Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -217,16 +217,6 @@

 #define ARC_FW_CMD_OK		0x41

-/* variable length msg */
-#define ARC_FW_MSG(_len)				\
-struct {						\
-	struct arc_fw_hdr	hdr;			\
-	u_int16_t		len;			\
-	u_int8_t		msg[(_len)];		\
-	u_int8_t		cksum;			\
-} __packed
-#define ARC_FW_MSGBUF(_msg)	((void *)(_msg)->msg)
-
 struct arc_fw_comminfo {
 	u_int8_t		baud_rate;
 	u_int8_t		data_bits;


gnrc_ipv6_nc: fix compilation error at debug output

--- sys/net/gnrc/network_layer/ipv6/nc/gnrc_ipv6_nc.c
+++ sys/net/gnrc/network_layer/ipv6/nc/gnrc_ipv6_nc.c
@@ -45,7 +45,7 @@
     }

     DEBUG("ipv6_nc: Remove %s for interface %" PRIkernel_pid "\n",
-          ipv6_addr_to_str(addr_str, ipv6_addr, sizeof(addr_str)),
+          ipv6_addr_to_str(addr_str, &(entry->ipv6_addr), sizeof(addr_str)),
           iface);

 #ifdef MODULE_GNRC_NDP_NODE


Only call dc_ramdac_intr if initialized(). Fixes a panic when starting Xtga. From NetBSD. ok deraadt@

--- dev/pci/tga.c
+++ dev/pci/tga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tga.c,v 1.12 2002/03/14 03:16:06 millert Exp $ */
+/* $OpenBSD: tga.c,v 1.13 2002/04/01 11:17:47 matthieu Exp $ */
 /* $NetBSD: tga.c,v 1.31 2001/02/11 19:34:58 nathanw Exp $ */

 /*
@@ -668,8 +668,11 @@
 			return 0;
 		}
 	}
-	dc->dc_ramdac_intr(dcrc);
-	dc->dc_ramdac_intr = NULL;
+	/* if we have something to do, do it */
+	if (dc->dc_ramdac_intr) {
+		dc->dc_ramdac_intr(dcrc);
+		dc->dc_ramdac_intr = NULL;
+	}
 	TGAWREG(dc, TGA_REG_SISR, 0x00000001);
 	TGAREGWB(dc, TGA_REG_SISR, 1);
 	return (1);


ng_sixlowpan: add missing return

ng_sixlowpan: add missing return

--- sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
+++ sys/net/network_layer/ng_sixlowpan/ng_sixlowpan.c
@@ -79,6 +79,7 @@
     if ((payload == NULL) || (payload->size < 1)) {
         DEBUG("6lo: Received packet has no 6LoWPAN payload\n");
         ng_pktbuf_release(pkt);
+        return;
     }

     dispatch = payload->data;


needs timeout.h to compile. from Rafael Neves

--- dev/usb/ubt.c
+++ dev/usb/ubt.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ubt.c,v 1.23 2013/04/15 09:23:02 mglocker Exp $	*/
+/*	$OpenBSD: ubt.c,v 1.24 2013/08/07 15:56:03 tedu Exp $	*/
 /*	$NetBSD: ubt.c,v 1.35 2008/07/28 14:19:26 drochner Exp $	*/

 /*-
@@ -74,6 +74,7 @@
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/systm.h>
+#include <sys/timeout.h>

 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>


soc: arm: nxp: kinetis: ke1xf: keep the sirc running in low-power mode

Keep the Slow Internal Reference Clock (SIRC) running in low-power
mode.

This allows peripherals that needs to remain operative in low-power
mode to use the SIRC as clock source.

Signed-off-by: Henrik Brix Andersen <24a3f13c22635bab658e39fc5f1e63c575328aae@vestas.com>

--- soc/arm/nxp_kinetis/ke1xf/soc.c
+++ soc/arm/nxp_kinetis/ke1xf/soc.c
@@ -83,7 +83,7 @@
 ASSERT_ASYNC_CLK_DIV_VALID(SCG_CLOCK_DIV(sircdiv2_clk),
 		       "Invalid SCG SIRC divider 2 value");
 static const scg_sirc_config_t scg_sirc_config = {
-	.enableMode = kSCG_SircEnable,
+	.enableMode = kSCG_SircEnable | kSCG_SircEnableInLowPower,
 	.div1       = TO_ASYNC_CLK_DIV(SCG_CLOCK_DIV(sircdiv1_clk)),
 	.div2       = TO_ASYNC_CLK_DIV(SCG_CLOCK_DIV(sircdiv2_clk)),
 #if MHZ(2) == DT_PROP(SCG_CLOCK_NODE(sirc_clk), clock_frequency)


Make the "Battery Present" sensor a depency of all the battery-related
sensors only if it is present, From David Higgs.

Fix a regression reported by and ok halex@

--- dev/usb/upd.c
+++ dev/usb/upd.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: upd.c,v 1.20 2015/05/11 08:51:31 mpi Exp $ */
+/*	$OpenBSD: upd.c,v 1.21 2015/05/14 13:50:34 mpi Exp $ */

 /*
  * Copyright (c) 2015 David Higgs <higgsd@gmail.com>
@@ -225,8 +225,12 @@

 	for (i = 0; i < nentries; i++) {
 		entry = entries + i;
-		if (!upd_lookup_usage_entry(desc, size, entry, &item))
+		if (!upd_lookup_usage_entry(desc, size, entry, &item)) {
+			/* dependency missing, add children to parent */
+			upd_attach_sensor_tree(sc, desc, size,
+			    entry->nchildren, entry->children, queue);
 			continue;
+		}

 		DPRINTF(("%s: found %s on repid=%d\n", DEVNAME(sc),
 		    entry->usage_name, item.report_ID));


added cc_newstr, similar to cc_strdup except uses new [] instead of malloc

Signed-off-by: Steven Noonan <4068f0880b399410602d694b3cc711c8a8f4727e@uplinklabs.net>

--- source/crisscross/universal_include.h
+++ source/crisscross/universal_include.h
@@ -337,6 +337,16 @@
 	return strcpy(dup, x);
 }

+inline char *cc_newstr(const char *x)
+{
+	if (!x) return NULL;
+
+	char *dup = new char[strlen(x) + 1];
+	if (!dup) return NULL;
+
+	return strcpy(dup, x);
+}
+
 #include <crisscross/compare.h>

 #define cc_min(x, y) (CrissCross::Data::Compare(x, y) < 0 ? x : y)


Separate the new defines

Separate the new defines

git-svn-id: b2ed898cf2cd3316b62ee1cc50465f4560571194@65 03a675c2-f56d-4096-908f-63dba836b7e4

--- lib/libaudit.h
+++ lib/libaudit.h
@@ -235,6 +235,8 @@

 #ifndef AUDIT_MAC_IPSEC_EVENT
 #define AUDIT_MAC_IPSEC_EVENT   1415    /* Audit an IPSec event */
+#endif
+#ifndef AUDIT_MAC_UNLBL_STCADD
 #define AUDIT_MAC_UNLBL_STCADD  1416    /* NetLabel: add a static label */
 #define AUDIT_MAC_UNLBL_STCDEL  1417    /* NetLabel: del a static label */
 #endif


libganglia: invert order of calloc parameters to match definition

--- lib/libgmond.c
+++ lib/libgmond.c
@@ -724,7 +724,7 @@
     else if (has_wildcard(fname))
     {
         int ret;
-        char *path = calloc(sizeof(char), strlen(fname)+1);
+        char *path = calloc(strlen(fname) + 1, sizeof(char));
         char *pattern = NULL;
         char *idx = strrchr(fname, '/');
         apr_pool_t *p;


Fix header guard

Fix header guard

Former-commit-id: 0d8ce8747cf55ce1543e5a7d4d8c038a41d27393

--- src/Buffer.h
+++ src/Buffer.h
@@ -1,5 +1,5 @@
-#ifndef HALIDE_BUFFER_H
-#define HALIDE_BUFFER_H
+#ifndef HALIDE_BUFFER_PTR_H
+#define HALIDE_BUFFER_PTR_H

 /** \file
  * Defines BufferPtr - A c++ wrapper around a buffer_t.


In pg_upgrade, add status message about superuser check.

--- contrib/pg_upgrade/check.c
+++ contrib/pg_upgrade/check.c
@@ -484,6 +484,8 @@
 	PGresult   *res;
 	PGconn	   *conn = connectToServer(cluster, "template1");

+	prep_status("Checking database user is a superuser");
+
 	/* Can't use pg_authid because only superusers can view it. */
 	res = executeQueryOrDie(conn,
 							"SELECT rolsuper "
@@ -497,6 +499,8 @@
 	PQclear(res);

 	PQfinish(conn);
+
+	check_ok();
 }


LBL chose to use IPPROTO_ENCAP to represent IP proto 4 encapsulation
as performed by the multicast kernel modifications.  However, BSD
already had IPPROTO_ENCAP defined as 98 (RFC 1241 encapsulation).

This changes the use of IPPROTO_ENCAP to IPPROTO_IPIP, which is
the BSD name for IP proto 4.

--- contrib/tcpdump/print-ip.c
+++ contrib/tcpdump/print-ip.c
@@ -445,10 +445,10 @@
 			igmp_print(cp, len, (const u_char *)ip);
 			break;

-#ifndef IPPROTO_ENCAP
-#define IPPROTO_ENCAP 4
-#endif
-		case IPPROTO_ENCAP:
+#ifndef IPPROTO_IPIP
+#define IPPROTO_IPIP 4
+#endif
+		case IPPROTO_IPIP:
 			/* ip-in-ip encapsulation */
 			if (vflag)
 				(void)printf("%s > %s: ",


Fix ChibiOS mailbox implementation for lwIP

Signed-off-by: José Simões <1616ff7a83d123f98f8f38fa2524eab406644781@eclo.solutions>

--- targets/CMSIS-OS/ChibiOS/Lwip/platform_sys_arch.c
+++ targets/CMSIS-OS/ChibiOS/Lwip/platform_sys_arch.c
@@ -53,24 +53,14 @@
 // the workaround is to use a ChibiOS mailbox and allocate memory for the mailbox and the buffer
 err_t sys_mbox_new(sys_mbox_t *mbox, int size)
 {
-    mailbox_t* mailbox = platform_malloc(sizeof(mailbox_t));
-    if (mailbox == NULL)
-    {
-        return ERR_MEM;
-    }
-
-    // allocate memory for message buffer
-    msg_t* messageBuffer = platform_malloc(sizeof(msg_t) * size);
-    if (messageBuffer == NULL)
+    *mbox = platform_malloc(sizeof(mailbox_t) + sizeof(msg_t) * size);
+    if (*mbox == NULL)
     {
         return ERR_MEM;
     }

     // init the mailbox
-    chMBObjectInit(mailbox, messageBuffer, size);
-
-    // need to return this
-    *mbox = (osMessageQId)mailbox;
+    chMBObjectInit((mailbox_t*)*mbox, (void *)(((uint8_t *)*mbox) + sizeof(mailbox_t)), size);

 #if SYS_STATS
       ++lwip_stats.sys.mbox.used;
@@ -90,14 +80,13 @@
 // Because this mailbox was created from heap (see sys_mbox_new above) need to free it here
 void sys_mbox_free(sys_mbox_t *mbox)
 {
-    mailbox_t* mailbox = (mailbox_t*)mbox;
     msg_t msgp;

     // check for messages waiting
     // If there are messages still present in the
     // mailbox when the mailbox is deallocated, it is an indication of a
     // programming error in lwIP and the developer should be notified.
-    if(chMBFetchI(mailbox, &msgp) != MSG_TIMEOUT)
+    if(chMBFetchI((mailbox_t*)*mbox, &msgp) != MSG_TIMEOUT)
 	{
       #if SYS_STATS
 	    lwip_stats.sys.mbox.err++;
@@ -107,14 +96,8 @@
         __asm volatile("BKPT #0\n");
 	}

-    // reset queue
-    chMBResetI(mailbox);
-
-    // free memory from buffer...
-    platform_free(mailbox->buffer);
-
     // ...free memory from mailbox
-    platform_free(mailbox);
+    platform_free(*mbox);
 }

 u32_t sys_now(void)


Fix the binary/tcp bug.

Fix the binary/tcp bug.

--- mud/kernel/lib/port.c
+++ mud/kernel/lib/port.c
@@ -21,7 +21,7 @@
 {
     catch {
 	::open_port(protocol, port);
-	porttype = protocol;
+	porttype = (protocol == "telnet") ? "telnet" : "binary";
 	return 1;
     } : {
 	return 0;


Rename TDTAsserts to match the XCTAssert names

--- TDTHotChocolate/TDTAssert.h
+++ TDTHotChocolate/TDTAssert.h
@@ -62,14 +62,17 @@

 #pragma mark - Convenience Assertions

+/// Signal an assertion failure if `expr` is NO.
+#define TDTAssertTrue(expr) TDTAssert(expr, nil)
+
+/// Signal an assertion failure if `expr` is nil.
+#define TDTAssertNotNil(expr) TDTAssert((expr) != nil, nil);
+
 /// Signal an unconditional assertion failure
 #define TDTAssertFailure(desc) TDTAssert(NO, desc)

 /// Signal an unconditional assertion failure -- this corresponds to NSAssert1
 #define TDTAssertFailure1(desc, arg1) TDTAssert1(NO, desc, arg1)
-
-/// Signal an assertion failure if `expr` is nil.
-#define TDTAssertNonNil(expr) TDTAssert((expr) != nil, @"NonNilAssertionFailure");

 /// Ensure that the current line is not executed on the main thread
 #define TDTAssertIsNotMainThread() \


Support the selection of a specified_visual for DM_buffers on the command line when using GLX_pbuffer.

--- source/three_d_drawing/dm_interface.c
+++ source/three_d_drawing/dm_interface.c
@@ -133,6 +133,7 @@
 	};
 #endif /* defined (GLX_SGIX_dm_pbuffer) */
 #if defined (GLX_pbuffer)
+	int visual_id, specified_visual_id;
 	int pbuffer_attribs [] =
 	{
 		GLX_PBUFFER_WIDTH, 0, /* Note that these 0 values are explictly overwritten below */
@@ -233,6 +234,10 @@
 	if(user_interface)
 	{
 		display = User_interface_get_display(user_interface);
+#if defined (GLX_pbuffer)
+		specified_visual_id = User_interface_get_specified_visual_id(
+			user_interface);
+#endif /* defined (GLX_pbuffer) */
 		if (depth_buffer)
 		{
 			visattrs = visattrsRGB_with_depth;
@@ -423,47 +428,72 @@
 					|| query_glx_extension("GLX_SGIX_pbuffer", display,
 					DefaultScreen(display)))
 				{
-					if (buffer->config_list = glXChooseFBConfig(display,
-						DefaultScreen(display), fbvisattrs, &nelements))
+					if (!specified_visual_id)
 					{
-						config_index = 0;
-						while ((config_index < nelements) &&
-							(!(buffer->pbuffer = glXCreatePbuffer(display,
-						   buffer->config_list[config_index], pbuffer_attribs))))
+						if (buffer->config_list = glXChooseFBConfig(display,
+							DefaultScreen(display), fbvisattrs, &nelements))
 						{
-							config_index++;
-						}
-						if (config_index < nelements)
-						{
-							buffer->config = buffer->config_list[config_index];
-						}
-						if (buffer->config && (buffer->visual_info =
-							glXGetVisualFromFBConfig(display, buffer->config)))
-						{
-							if (buffer->context = glXCreateNewContext(
-								display, buffer->config, GLX_RGBA_TYPE,
-								ThreeDDrawing_get_shareable_context(), GL_TRUE))
+							config_index = 0;
+							while (config_index < nelements &&
+								(!(buffer->pbuffer = glXCreatePbuffer(display,
+								buffer->config_list[config_index], pbuffer_attribs))))
 							{
-								/* Finished I think, hooray! */
-							}
-							else
-							{
-								display_message(ERROR_MESSAGE,"CREATE(Dm_buffer). Cannot get GLX context");
-								DEALLOCATE(buffer);
-								buffer = (struct Dm_buffer *)NULL;
+								config_index++;
 							}
 						}
 						else
 						{
-							display_message(ERROR_MESSAGE,"CREATE(Dm_buffer).  "
-								"Cannot create pbuffer for any possible frame buffers");
+							display_message(ERROR_MESSAGE,"CREATE(Dm_buffer). Cannot get list of Frame Buffer Configurations");
 							DEALLOCATE(buffer);
 							buffer = (struct Dm_buffer *)NULL;
 						}
 					}
 					else
 					{
-						display_message(ERROR_MESSAGE,"CREATE(Dm_buffer). Cannot get list of Frame Buffer Configurations");
+						/* Get all the configs and look for the specified visual */
+						if (buffer->config_list = glXGetFBConfigs(display,
+							DefaultScreen(display), &nelements))
+						{
+							config_index = 0;
+							while ((config_index < nelements) && !(buffer->pbuffer))
+							{
+								visual_id = 0;
+								glXGetFBConfigAttrib(display,
+									buffer->config_list[config_index],
+									GLX_VISUAL_ID, &visual_id);
+								if ((specified_visual_id != visual_id) ||
+									(!(buffer->pbuffer = glXCreatePbuffer(display,
+									buffer->config_list[config_index], pbuffer_attribs))))
+								{
+									config_index++;
+								}
+							}
+						}
+					}
+					if (config_index < nelements)
+					{
+						buffer->config = buffer->config_list[config_index];
+					}
+					if (buffer->config && (buffer->visual_info =
+							 glXGetVisualFromFBConfig(display, buffer->config)))
+					{
+						if (buffer->context = glXCreateNewContext(
+								 display, buffer->config, GLX_RGBA_TYPE,
+								 ThreeDDrawing_get_shareable_context(), GL_TRUE))
+						{
+							/* Finished I think, hooray! */
+						}
+						else
+						{
+							display_message(ERROR_MESSAGE,"CREATE(Dm_buffer). Cannot get GLX context");
+							DEALLOCATE(buffer);
+							buffer = (struct Dm_buffer *)NULL;
+						}
+					}
+					else
+					{
+						display_message(ERROR_MESSAGE,"CREATE(Dm_buffer).  "
+							"Cannot create pbuffer for any possible frame buffers");
 						DEALLOCATE(buffer);
 						buffer = (struct Dm_buffer *)NULL;
 					}
@@ -777,6 +807,7 @@
 		if (1 == buffer->double_buffered)
 		{
 #if defined (GLX_SGIX_dm_pbuffer) || (GLX_SGIX_pbuffer) || (GLX_pbuffer)
+			Dm_buffer_glx_make_current(buffer);
 			if (buffer->pbuffer)
 			{
 				glXSwapBuffers(User_interface_get_display(buffer->user_interface),


Access to default cuts and flags.

Access to default cuts and flags.

--- TFluka/TFlukaConfigOption.h
+++ TFluka/TFlukaConfigOption.h
@@ -71,6 +71,7 @@
     //
     static void SetStaticInfo(FILE* file, Float_t matMin, Float_t matMax, TFlukaMCGeometry* geom)
 	{fgFile = file; fgMatMin = matMin; fgMatMax = matMax; fgGeom = geom;}
+    static Double_t DefaultCut(FlukaCutOption_t i) {return fgDCutValue[i];}
  protected:
     Double_t fCutValue[11];            // User cut
     Int_t    fProcessFlag[15];         // User flag assigned to processes