Stop using "this" in luma.c

Stop using "this" in luma.c

--- src/modules/lumas/luma.c
+++ src/modules/lumas/luma.c
@@ -1,6 +1,6 @@
 /*
  * luma.c -- image generator for transition_luma
- * Copyright (C) 2003-2014 Meltytech, LLC
+ * Copyright (C) 2003-2018 Meltytech, LLC
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -43,24 +43,24 @@
 }
 luma;

-void luma_init( luma *this )
+void luma_init( luma *self )
 {
-	memset( this, 0, sizeof( luma ) );
-	this->type = 0;
-	this->w = 720;
-	this->h = 576;
-	this->bands = 1;
-	this->rband = 0;
-	this->vmirror = 0;
-	this->hmirror = 0;
-	this->dmirror = 0;
-	this->invert = 0;
-	this->offset = 0;
-	this->flip = 0;
-	this->flop = 0;
-	this->quart = 0;
-	this->pflop = 0;
-	this->pflip = 0;
+	memset( self, 0, sizeof( luma ) );
+	self->type = 0;
+	self->w = 720;
+	self->h = 576;
+	self->bands = 1;
+	self->rband = 0;
+	self->vmirror = 0;
+	self->hmirror = 0;
+	self->dmirror = 0;
+	self->invert = 0;
+	self->offset = 0;
+	self->flip = 0;
+	self->flop = 0;
+	self->quart = 0;
+	self->pflop = 0;
+	self->pflip = 0;
 }

 static inline int sqrti( int n )
@@ -88,53 +88,53 @@
     return p;
 }

-uint16_t *luma_render( luma *this )
+uint16_t *luma_render( luma *self )
 {
 	int i = 0;
 	int j = 0;
 	int k = 0;

-	if ( this->quart )
-	{
-		this->w *= 2;
-		this->h *= 2;
-	}
-
-	if ( this->rotate )
-	{
-		int t = this->w;
-		this->w = this->h;
-		this->h = t;
+	if ( self->quart )
+	{
+		self->w *= 2;
+		self->h *= 2;
+	}
+
+	if ( self->rotate )
+	{
+		int t = self->w;
+		self->w = self->h;
+		self->h = t;
 	}

 	int max = ( 1 << 16 ) - 1;
-	uint16_t *image = malloc( this->w * this->h * sizeof( uint16_t ) );
-	uint16_t *end = image + this->w * this->h;
+	uint16_t *image = malloc( self->w * self->h * sizeof( uint16_t ) );
+	uint16_t *end = image + self->w * self->h;
 	uint16_t *p = image;
 	uint16_t *r = image;
 	int lower = 0;
-	int lpb = this->h / this->bands;
-	int rpb = max / this->bands;
+	int lpb = self->h / self->bands;
+	int rpb = max / self->bands;
 	int direction = 1;

-	int half_w = this->w / 2;
-	int half_h = this->h / 2;
-
-	if ( !this->dmirror && ( this->hmirror || this->vmirror ) )
+	int half_w = self->w / 2;
+	int half_h = self->h / 2;
+
+	if ( !self->dmirror && ( self->hmirror || self->vmirror ) )
 		rpb *= 2;

-	for ( i = 0; i < this->bands; i ++ )
+	for ( i = 0; i < self->bands; i ++ )
 	{
 		lower = i * rpb;
 		direction = 1;

-		if ( this->rband && i % 2 == 1 )
+		if ( self->rband && i % 2 == 1 )
 		{
 			direction = -1;
 			lower += rpb;
 		}

-		switch( this->type )
+		switch( self->type )
 		{
 			case 1:
 				{
@@ -145,11 +145,11 @@
 					for ( j = 0; j < lpb; j ++ )
 					{
 						y = j - lpb / 2;
-						for ( k = 0; k < this->w; k ++ )
+						for ( k = 0; k < self->w; k ++ )
 						{
 							x = k - half_w;
 							value = sqrti( x * x + y * y );
-							*p ++ = lower + ( direction * rpb * ( ( max * value ) / length ) / max ) + ( j * this->offset * 2 / lpb ) + ( j * this->offset / lpb );
+							*p ++ = lower + ( direction * rpb * ( ( max * value ) / length ) / max ) + ( j * self->offset * 2 / lpb ) + ( j * self->offset / lpb );
 						}
 					}
 				}
@@ -159,13 +159,13 @@
 				{
 					for ( j = 0; j < lpb; j ++ )
 					{
-						int value = ( ( j * this->w ) / lpb ) - half_w;
+						int value = ( ( j * self->w ) / lpb ) - half_w;
 						if ( value > 0 )
 							value = - value;
 						for ( k = - half_w; k < value; k ++ )
 							*p ++ = lower + ( direction * rpb * ( ( max * abs( k ) ) / half_w ) / max );
 						for ( k = value; k < abs( value ); k ++ )
-							*p ++ = lower + ( direction * rpb * ( ( max * abs( value ) ) / half_w ) / max ) + ( j * this->offset * 2 / lpb ) + ( j * this->offset / lpb );
+							*p ++ = lower + ( direction * rpb * ( ( max * abs( value ) ) / half_w ) / max ) + ( j * self->offset * 2 / lpb ) + ( j * self->offset / lpb );
 						for ( k = abs( value ); k < half_w; k ++ )
 							*p ++ = lower + ( direction * rpb * ( ( max * abs( k ) ) / half_w ) / max );
 					}
@@ -199,45 +199,45 @@

 			default:
 				for ( j = 0; j < lpb; j ++ )
-					for ( k = 0; k < this->w; k ++ )
-						*p ++ = lower + ( direction * ( rpb * ( ( k * max ) / this->w ) / max ) ) + ( j * this->offset * 2 / lpb );
+					for ( k = 0; k < self->w; k ++ )
+						*p ++ = lower + ( direction * ( rpb * ( ( k * max ) / self->w ) / max ) ) + ( j * self->offset * 2 / lpb );
 				break;
 		}
 	}

-	if ( this->quart )
-	{
-		this->w /= 2;
-		this->h /= 2;
-		for ( i = 1; i < this->h; i ++ )
-		{
-			p = image + i * this->w;
-			r = image + i * 2 * this->w;
-			j = this->w;
+	if ( self->quart )
+	{
+		self->w /= 2;
+		self->h /= 2;
+		for ( i = 1; i < self->h; i ++ )
+		{
+			p = image + i * self->w;
+			r = image + i * 2 * self->w;
+			j = self->w;
 			while ( j -- > 0 )
 				*p ++ = *r ++;
 		}
 	}

-	if ( this->dmirror )
-	{
-		for ( i = 0; i < this->h; i ++ )
-		{
-			p = image + i * this->w;
-			r = end - i * this->w;
-			j = ( this->w * ( this->h - i ) ) / this->h;
+	if ( self->dmirror )
+	{
+		for ( i = 0; i < self->h; i ++ )
+		{
+			p = image + i * self->w;
+			r = end - i * self->w;
+			j = ( self->w * ( self->h - i ) ) / self->h;
 			while ( j -- )
 				*( -- r ) = *p ++;
 		}
 	}

-	if ( this->flip )
+	if ( self->flip )
 	{
 		uint16_t t;
-		for ( i = 0; i < this->h; i ++ )
-		{
-			p = image + i * this->w;
-			r = p + this->w;
+		for ( i = 0; i < self->h; i ++ )
+		{
+			p = image + i * self->w;
+			r = p + self->w;
 			while( p != r )
 			{
 				t = *p;
@@ -247,14 +247,14 @@
 		}
 	}

-	if ( this->flop )
+	if ( self->flop )
 	{
 		uint16_t t;
 		r = end;
-		for ( i = 1; i < this->h / 2; i ++ )
-		{
-			p = image + i * this->w;
-			j = this->w;
+		for ( i = 1; i < self->h / 2; i ++ )
+		{
+			p = image + i * self->w;
+			j = self->w;
 			while( j -- )
 			{
 				t = *( -- p );
@@ -264,19 +264,19 @@
 		}
 	}

-	if ( this->hmirror )
+	if ( self->hmirror )
 	{
 		p = image;
 		while ( p < end )
 		{
-			r = p + this->w;
+			r = p + self->w;
 			while ( p != r )
 				*( -- r ) = *p ++;
-			p += this->w / 2;
-		}
-	}
-
-	if ( this->vmirror )
+			p += self->w / 2;
+		}
+	}
+
+	if ( self->vmirror )
 	{
 		p = image;
 		r = end;
@@ -284,7 +284,7 @@
 			*( -- r ) = *p ++;
 	}

-	if ( this->invert )
+	if ( self->invert )
 	{
 		p = image;
 		r = image;
@@ -292,13 +292,13 @@
 			*p ++ = max - *r ++;
 	}

-	if ( this->pflip )
+	if ( self->pflip )
 	{
 		uint16_t t;
-		for ( i = 0; i < this->h; i ++ )
-		{
-			p = image + i * this->w;
-			r = p + this->w;
+		for ( i = 0; i < self->h; i ++ )
+		{
+			p = image + i * self->w;
+			r = p + self->w;
 			while( p != r )
 			{
 				t = *p;
@@ -308,15 +308,15 @@
 		}
 	}

-	if ( this->pflop )
+	if ( self->pflop )
 	{
 		uint16_t t;
-		end = image + this->w * this->h;
+		end = image + self->w * self->h;
 		r = end;
-		for ( i = 1; i < this->h / 2; i ++ )
-		{
-			p = image + i * this->w;
-			j = this->w;
+		for ( i = 1; i < self->h / 2; i ++ )
+		{
+			p = image + i * self->w;
+			j = self->w;
 			while( j -- )
 			{
 				t = *( -- p );
@@ -326,22 +326,22 @@
 		}
 	}

-	if ( this->rotate )
-	{
-		uint16_t *image2 = malloc( this->w * this->h * sizeof( uint16_t ) );
-		for ( i = 0; i < this->h; i ++ )
-		{
-			p = image + i * this->w;
-			r = image2 + this->h - i - 1;
-			for ( j = 0; j < this->w; j ++ )
+	if ( self->rotate )
+	{
+		uint16_t *image2 = malloc( self->w * self->h * sizeof( uint16_t ) );
+		for ( i = 0; i < self->h; i ++ )
+		{
+			p = image + i * self->w;
+			r = image2 + self->h - i - 1;
+			for ( j = 0; j < self->w; j ++ )
 			{
 				*r = *( p ++ );
-				r += this->h;
+				r += self->h;
 			}
 		}
-		i = this->w;
-		this->w = this->h;
-		this->h = i;
+		i = self->w;
+		self->w = self->h;
+		self->h = i;
 		free( image );
 		image = image2;
 	}
@@ -354,23 +354,23 @@
 	int arg = 1;
 	int bpp = 8;

-	luma this;
+	luma self;
 	uint16_t *image = NULL;

-	luma_init( &this );
+	luma_init( &self );

 	for ( arg = 1; arg < argc - 1; arg ++ )
 	{
 		if ( !strcmp( argv[ arg ], "-bpp" ) )
 			bpp = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-type" ) )
-			this.type = atoi( argv[ ++ arg ] );
+			self.type = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-w" ) )
 		{
 			int tmp = atoi( argv[ ++ arg ] );
 			// TODO: is there an upper bound?
 			if ( tmp )
-				this.w = tmp;
+				self.w = tmp;
 			else
 				return 1;
 		}
@@ -379,7 +379,7 @@
 			int tmp = atoi( argv[ ++ arg ] );
 			// TODO: is there an upper bound?
 			if ( tmp )
-				this.h = tmp;
+				self.h = tmp;
 			else return 1;
 		}
 		else if ( !strcmp( argv[ arg ], "-bands" ) )
@@ -387,34 +387,34 @@
 			int tmp = atoi( argv[ ++ arg ] );
 			// TODO: is there an upper bound?
 			if ( tmp >= 0 )
-				this.bands = tmp;
+				self.bands = tmp;
 			else
 				return 1;
 		}
 		else if ( !strcmp( argv[ arg ], "-rband" ) )
-			this.rband = atoi( argv[ ++ arg ] );
+			self.rband = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-hmirror" ) )
-			this.hmirror = atoi( argv[ ++ arg ] );
+			self.hmirror = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-vmirror" ) )
-			this.vmirror = atoi( argv[ ++ arg ] );
+			self.vmirror = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-dmirror" ) )
-			this.dmirror = atoi( argv[ ++ arg ] );
+			self.dmirror = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-offset" ) )
-			this.offset = atoi( argv[ ++ arg ] );
+			self.offset = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-invert" ) )
-			this.invert = atoi( argv[ ++ arg ] );
+			self.invert = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-flip" ) )
-			this.flip = atoi( argv[ ++ arg ] );
+			self.flip = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-flop" ) )
-			this.flop = atoi( argv[ ++ arg ] );
+			self.flop = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-pflip" ) )
-			this.pflip = atoi( argv[ ++ arg ] );
+			self.pflip = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-pflop" ) )
-			this.pflop = atoi( argv[ ++ arg ] );
+			self.pflop = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-quart" ) )
-			this.quart = atoi( argv[ ++ arg ] );
+			self.quart = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-rotate" ) )
-			this.rotate = atoi( argv[ ++ arg ] );
+			self.rotate = atoi( argv[ ++ arg ] );
 		else
 			fprintf( stderr, "ignoring %s\n", argv[ arg ] );
 	}
@@ -425,11 +425,11 @@
 		return 1;
 	}

-	image = luma_render( &this );
+	image = luma_render( &self );

 	if ( bpp == 16 )
 	{
-		uint16_t *end = image + this.w * this.h;
+		uint16_t *end = image + self.w * self.h;
 		uint16_t *p = image;
 		uint8_t *q = ( uint8_t * )image;
 		while ( p < end )
@@ -438,21 +438,21 @@
 			q += 2;
 		}
 		printf( "P5\n" );
-		printf( "%d %d\n", this.w, this.h );
+		printf( "%d %d\n", self.w, self.h );
 		printf( "65535\n" );
-		fwrite( image, this.w * this.h * sizeof( uint16_t ), 1, stdout );
+		fwrite( image, self.w * self.h * sizeof( uint16_t ), 1, stdout );
 	}
 	else
 	{
-		uint16_t *end = image + this.w * this.h;
+		uint16_t *end = image + self.w * self.h;
 		uint16_t *p = image;
 		uint8_t *q = ( uint8_t * )image;
 		while ( p < end )
 			*q ++ = ( uint8_t )( *p ++ >> 8 );
 		printf( "P5\n" );
-		printf( "%d %d\n", this.w, this.h );
+		printf( "%d %d\n", self.w, self.h );
 		printf( "255\n" );
-		fwrite( image, this.w * this.h, 1, stdout );
+		fwrite( image, self.w * self.h, 1, stdout );
 	}

 	return 0;


comments

comments

--- Library/Sources/Stroika/Foundation/IO/Network/InternetAddress.h
+++ Library/Sources/Stroika/Foundation/IO/Network/InternetAddress.h
@@ -309,7 +309,8 @@
     private:
         AddressFamily fAddressFamily_;
         union {
-            in_addr            fV4_; // Stored in network byte order
+            // EACH Stored in network byte order
+            in_addr            fV4_;
             in6_addr           fV6_;
             array<uint8_t, 4>  fArray_4_uint_;
             array<byte, 4>     fArray_4_byte_;


docs cleanups

docs cleanups

--- Library/Sources/Stroika/Foundation/Streams/SharedMemoryStream.h
+++ Library/Sources/Stroika/Foundation/Streams/SharedMemoryStream.h
@@ -128,7 +128,7 @@

             public:
                 /**
-                 *  Convert the current contents of this MemoryStream into one of the "T" representations.
+                 *  Convert the current contents of this SharedMemoryStream into one of the "T" representations.
                  *  T can be one of:
                  *      o   vector<ElementType>
                  *


net: shell: Add extra net_pkt RX timing statistics

Add extra net_pkt RX timing information to "net stats" command.
You neeed to enable CONFIG_NET_PKT_RXTIME_STATS and
CONFIG_NET_PKT_RXTIME_STATS_DETAIL config options.
The "net stats" command will print something like this:

Avg RX net_pkt (7) time 459 us	[0->23->16->257->160=456 us]

The extra stats is the end of line inside brackets.

Signed-off-by: Jukka Rissanen <f9f077d1da4c7aa947f9864fa5a28c3588f6a45d@linux.intel.com>

--- subsys/net/ip/net_shell.c
+++ subsys/net/ip/net_shell.c
@@ -733,6 +733,170 @@
 #define GET_STAT(a, b) 0
 #endif

+#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) || \
+	defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
+#if (NET_TC_TX_COUNT > 1) || (NET_TC_RX_COUNT > 1)
+static char *get_net_pkt_tc_stats_detail(struct net_if *iface, int i,
+					  bool is_tx)
+{
+	static char extra_stats[sizeof("\t[0=xxxx us]") +
+				sizeof("->xxxx") *
+				NET_PKT_DETAIL_STATS_COUNT];
+	int j, total = 0, pos = 0;
+
+	pos += snprintk(extra_stats, sizeof(extra_stats), "\t[0");
+
+	for (j = 0; j < NET_PKT_DETAIL_STATS_COUNT; j++) {
+		net_stats_t count = 0;
+		uint32_t avg;
+
+		if (is_tx) {
+#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) && (NET_TC_TX_COUNT > 1)
+			count = GET_STAT(iface,
+					 tc.sent[i].tx_time_detail[j].count);
+#endif
+		} else {
+#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL) && (NET_TC_RX_COUNT > 1)
+			count = GET_STAT(iface,
+					 tc.recv[i].rx_time_detail[j].count);
+#endif
+		}
+
+		if (count == 0) {
+			break;
+		}
+
+		if (is_tx) {
+#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) && (NET_TC_TX_COUNT > 1)
+			avg = (uint32_t)(GET_STAT(iface,
+					   tc.sent[i].tx_time_detail[j].sum) /
+				      (uint64_t)count);
+#endif
+		} else {
+#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL) && (NET_TC_RX_COUNT > 1)
+			avg = (uint32_t)(GET_STAT(iface,
+					   tc.recv[i].rx_time_detail[j].sum) /
+				      (uint64_t)count);
+#endif
+		}
+
+		if (avg == 0) {
+			continue;
+		}
+
+		total += avg;
+
+		pos += snprintk(extra_stats + pos, sizeof(extra_stats) - pos,
+				"->%u", avg);
+	}
+
+	if (total == 0U) {
+		return "\0";
+	}
+
+	pos += snprintk(extra_stats + pos, sizeof(extra_stats) - pos,
+				"=%u us]", total);
+
+	return extra_stats;
+}
+#endif /* (NET_TC_TX_COUNT > 1) || (NET_TC_RX_COUNT > 1) */
+
+#if (NET_TC_TX_COUNT == 1) || (NET_TC_RX_COUNT == 1)
+static char *get_net_pkt_stats_detail(struct net_if *iface, bool is_tx)
+{
+	static char extra_stats[sizeof("\t[0=xxxx us]") + sizeof("->xxxx") *
+				NET_PKT_DETAIL_STATS_COUNT];
+	int j, total = 0, pos = 0;
+
+	pos += snprintk(extra_stats, sizeof(extra_stats), "\t[0");
+
+	for (j = 0; j < NET_PKT_DETAIL_STATS_COUNT; j++) {
+		net_stats_t count;
+		uint32_t avg;
+
+		if (is_tx) {
+#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
+			count = GET_STAT(iface, tx_time_detail[j].count);
+#endif
+		} else {
+#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
+			count = GET_STAT(iface, rx_time_detail[j].count);
+#endif
+		}
+
+		if (count == 0) {
+			break;
+		}
+
+		if (is_tx) {
+#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
+			avg = (uint32_t)(GET_STAT(iface,
+					       tx_time_detail[j].sum) /
+				      (uint64_t)count);
+#endif
+		} else {
+#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
+			avg = (uint32_t)(GET_STAT(iface,
+					       rx_time_detail[j].sum) /
+				      (uint64_t)count);
+#endif
+		}
+
+		if (avg == 0) {
+			continue;
+		}
+
+		total += avg;
+
+		pos += snprintk(extra_stats + pos,
+				sizeof(extra_stats) - pos,
+				"->%u", avg);
+	}
+
+	if (total == 0U) {
+		return "\0";
+	}
+
+	pos += snprintk(extra_stats + pos, sizeof(extra_stats) - pos,
+			"=%u us]", total);
+
+	return extra_stats;
+}
+#endif /* (NET_TC_TX_COUNT == 1) || (NET_TC_RX_COUNT == 1) */
+
+#else /* CONFIG_NET_PKT_TXTIME_STATS_DETAIL ||
+	 CONFIG_NET_PKT_RXTIME_STATS_DETAIL */
+
+#if defined(CONFIG_NET_PKT_TXTIME_STATS) || \
+	defined(CONFIG_NET_PKT_RXTIME_STATS) || \
+	defined(CONFIG_NET_CONTEXT_TIMESTAMP)
+
+#if (NET_TC_TX_COUNT > 1) || (NET_TC_RX_COUNT > 1)
+static char *get_net_pkt_tc_stats_detail(struct net_if *iface, int i,
+					 bool is_tx)
+{
+	ARG_UNUSED(iface);
+	ARG_UNUSED(i);
+	ARG_UNUSED(is_tx);
+
+	return "\0";
+}
+#endif
+
+#if (NET_TC_TX_COUNT == 1) || (NET_TC_RX_COUNT == 1)
+static char *get_net_pkt_stats_detail(struct net_if *iface, bool is_tx)
+{
+	ARG_UNUSED(iface);
+	ARG_UNUSED(is_tx);
+
+	return "\0";
+}
+#endif
+#endif /* CONFIG_NET_PKT_TXTIME_STATS) || CONFIG_NET_PKT_RXTIME_STATS ||
+	  CONFIG_NET_CONTEXT_TIMESTAMP */
+#endif /* CONFIG_NET_PKT_TXTIME_STATS_DETAIL ||
+	  CONFIG_NET_PKT_RXTIME_STATS_DETAIL */
+
 static void print_tc_tx_stats(const struct shell *shell, struct net_if *iface)
 {
 #if NET_TC_TX_COUNT > 1
@@ -754,42 +918,6 @@
 			   GET_STAT(iface, tc.sent[i].pkts),
 			   GET_STAT(iface, tc.sent[i].bytes));
 		} else {
-#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
-			char extra_stats[sizeof("\t[0=xxxx us]") +
-					 sizeof("->xxxx") *
-					 NET_PKT_DETAIL_STATS_COUNT];
-			int j, total = 0, pos = 0;
-
-			pos += snprintk(extra_stats, sizeof(extra_stats),
-					"\t[0");
-
-			for (j = 0; j < NET_PKT_DETAIL_STATS_COUNT; j++) {
-				net_stats_t count2 = GET_STAT(iface,
-				      tc.sent[i].tx_time_detail[j].count);
-
-				if (count2 != 0) {
-					uint32_t avg;
-
-					avg = (uint32_t)(GET_STAT(iface,
-					    tc.sent[i].tx_time_detail[j].sum) /
-					    (uint64_t)count2);
-
-					total += avg;
-
-					pos += snprintk(
-						extra_stats + pos,
-						sizeof(extra_stats) - pos,
-						"->%u", avg);
-				}
-			}
-
-			pos += snprintk(extra_stats + pos,
-					sizeof(extra_stats) - pos,
-					"=%u us]", total);
-#else
-			const char *extra_stats = "\0";
-#endif
-
 			PR("[%d] %s (%d)\t%d\t\t%d\t%lu us%s\n", i,
 			   priority2str(GET_STAT(iface, tc.sent[i].priority)),
 			   GET_STAT(iface, tc.sent[i].priority),
@@ -797,8 +925,8 @@
 			   GET_STAT(iface, tc.sent[i].bytes),
 			   (uint32_t)(GET_STAT(iface,
 					    tc.sent[i].tx_time.sum) /
-				      (uint64_t)count),
-			   extra_stats);
+				   (uint64_t)count),
+			   get_net_pkt_tc_stats_detail(iface, i, true));
 		}
 	}
 #else
@@ -819,40 +947,9 @@
 	net_stats_t count = GET_STAT(iface, tx_time.count);

 	if (count != 0) {
-#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
-		char extra_stats[sizeof("\t[0=xxxx us]") + sizeof("->xxxx") *
-				 NET_PKT_DETAIL_STATS_COUNT];
-		int j, total = 0, pos = 0;
-
-		pos += snprintk(extra_stats, sizeof(extra_stats), "\t[0");
-
-		for (j = 0; j < NET_PKT_DETAIL_STATS_COUNT; j++) {
-			net_stats_t count2 =
-				GET_STAT(iface, tx_time_detail[j].count);
-
-			if (count2 != 0) {
-				uint32_t avg = (uint32_t)
-					(GET_STAT(iface,
-						  tx_time_detail[j].sum) /
-					 (uint64_t)count2);
-
-				total += avg;
-
-				pos += snprintk(extra_stats + pos,
-						sizeof(extra_stats) - pos,
-						"->%u", avg);
-			}
-		}
-
-		pos += snprintk(extra_stats + pos, sizeof(extra_stats) - pos,
-				"=%u us]", total);
-#else
-		const char *extra_stats = "\0";
-#endif
-
 		PR("Avg %s net_pkt (%u) time %lu us%s\n", "TX", count,
 		   (uint32_t)(GET_STAT(iface, tx_time.sum) / (uint64_t)count),
-		   extra_stats);
+		   get_net_pkt_stats_detail(iface, true));
 	}
 #else
 	ARG_UNUSED(iface);
@@ -880,14 +977,15 @@
 			   GET_STAT(iface, tc.recv[i].pkts),
 			   GET_STAT(iface, tc.recv[i].bytes));
 		} else {
-			PR("[%d] %s (%d)\t%d\t\t%d\t%lu us\n", i,
+			PR("[%d] %s (%d)\t%d\t\t%d\t%lu us%s\n", i,
 			   priority2str(GET_STAT(iface, tc.recv[i].priority)),
 			   GET_STAT(iface, tc.recv[i].priority),
 			   GET_STAT(iface, tc.recv[i].pkts),
 			   GET_STAT(iface, tc.recv[i].bytes),
 			   (uint32_t)(GET_STAT(iface,
 					    tc.recv[i].rx_time.sum) /
-				   (uint64_t)count));
+				   (uint64_t)count),
+			   get_net_pkt_tc_stats_detail(iface, i, false));
 		}
 	}
 #else
@@ -908,8 +1006,9 @@
 	net_stats_t count = GET_STAT(iface, rx_time.count);

 	if (count != 0) {
-		PR("Avg %s net_pkt (%u) time %lu us\n", "RX", count,
-		   (uint32_t)(GET_STAT(iface, rx_time.sum) / (uint64_t)count));
+		PR("Avg %s net_pkt (%u) time %lu us%s\n", "RX", count,
+		   (uint32_t)(GET_STAT(iface, rx_time.sum) / (uint64_t)count),
+		   get_net_pkt_stats_detail(iface, false));
 	}
 #else
 	ARG_UNUSED(iface);


InnoDB: cleanup of B-tree cursor operations

innobase/btr/btr0cur.c:
  Remove unused parameter of btr_cur_latch_leaves()
  Simplify logic and add debug assertion in btr_cur_search_to_nth_level()

--- innobase/btr/btr0cur.c
+++ innobase/btr/btr0cur.c
@@ -120,7 +120,6 @@
 void
 btr_cur_latch_leaves(
 /*=================*/
-	dict_tree_t*	tree __attribute__((unused)),	/* in: index tree */
 	page_t*		page,		/* in: leaf page where the search
 					converged */
 	ulint		space,		/* in: space id */
@@ -133,7 +132,7 @@
 	ulint	right_page_no;
 	page_t*	get_page;

-	ut_ad(tree && page && mtr);
+	ut_ad(page && mtr);

 	if (latch_mode == BTR_SEARCH_LEAF) {

@@ -365,17 +364,19 @@
 	B-tree. These let us end up in the right B-tree leaf. In that leaf
 	we use the original search mode. */

-	if (mode == PAGE_CUR_GE) {
+	switch (mode) {
+	case PAGE_CUR_GE:
 		page_mode = PAGE_CUR_L;
-	} else if (mode == PAGE_CUR_G) {
+		break;
+	case PAGE_CUR_G:
 		page_mode = PAGE_CUR_LE;
-	} else if (mode == PAGE_CUR_LE) {
-		page_mode = PAGE_CUR_LE;
-	} else if (mode == PAGE_CUR_LE_OR_EXTENDS) {
-		page_mode = PAGE_CUR_LE_OR_EXTENDS;
-	} else {
-		ut_ad(mode == PAGE_CUR_L);
-		page_mode = PAGE_CUR_L;
+		break;
+	default:
+		ut_ad(mode == PAGE_CUR_L
+			|| mode == PAGE_CUR_LE
+			|| mode == PAGE_CUR_LE_OR_EXTENDS);
+		page_mode = mode;
+		break;
 	}

 	/* Loop and search until we arrive at the desired level */
@@ -450,7 +451,7 @@
 		if (height == 0) {
 			if (rw_latch == RW_NO_LATCH) {

-				btr_cur_latch_leaves(tree, page, space,
+				btr_cur_latch_leaves(page, space,
 						page_no, latch_mode, cursor,
 						mtr);
 			}
@@ -476,6 +477,9 @@
 		}

 		/* If this is the desired level, leave the loop */
+
+		ut_ad(height
+		== btr_page_get_level(page_cur_get_page(page_cursor), mtr));

 		if (level == height) {

@@ -588,7 +592,7 @@
 		}

 		if (height == 0) {
-			btr_cur_latch_leaves(tree, page, space, page_no,
+			btr_cur_latch_leaves(page, space, page_no,
 						latch_mode, cursor, mtr);

 			/* In versions <= 3.23.52 we had forgotten to
@@ -694,7 +698,7 @@
 		}

 		if (height == 0) {
-			btr_cur_latch_leaves(tree, page, space, page_no,
+			btr_cur_latch_leaves(page, space, page_no,
 						latch_mode, cursor, mtr);
 		}


net: shell: Fix showing ping reply

net: shell: Fix showing ping reply

shell_fprintf() doesn't work in callback handlers.
To fix that, set shell state to SHELL_STATE_COMMAND before using it.

Fixed: #12347

Signed-off-by: Frank Li <49244b28ad48c35f973a9a3c4ee9a34d02acfa11@163.com>

--- subsys/net/ip/net_shell.c
+++ subsys/net/ip/net_shell.c
@@ -3033,10 +3033,11 @@

 static enum net_verdict _handle_ipv6_echo_reply(struct net_pkt *pkt)
 {
+	shell_command_enter(shell_for_ping);
 	PR_SHELL(shell_for_ping, "Received echo reply from %s to %s\n",
 		 net_sprint_ipv6_addr(&NET_IPV6_HDR(pkt)->src),
 		 net_sprint_ipv6_addr(&NET_IPV6_HDR(pkt)->dst));
-
+	shell_command_exit(shell_for_ping);
 	k_sem_give(&ping_timeout);
 	_remove_ipv6_ping_handler();

@@ -3107,10 +3108,11 @@

 static enum net_verdict _handle_ipv4_echo_reply(struct net_pkt *pkt)
 {
+	shell_command_enter(shell_for_ping);
 	PR_SHELL(shell_for_ping, "Received echo reply from %s to %s\n",
 		 net_sprint_ipv4_addr(&NET_IPV4_HDR(pkt)->src),
 		 net_sprint_ipv4_addr(&NET_IPV4_HDR(pkt)->dst));
-
+	shell_command_exit(shell_for_ping);
 	k_sem_give(&ping_timeout);
 	_remove_ipv4_ping_handler();


mem0dbg.c:   Backport from 4.1: make mem_current_allocated_memory global variable

--- innobase/mem/mem0dbg.c
+++ innobase/mem/mem0dbg.c
@@ -20,7 +20,7 @@
 static ulint	mem_n_created_heaps 		= 0;
 static ulint	mem_n_allocations	  	= 0;
 static ulint	mem_total_allocated_memory	= 0;
-static ulint	mem_current_allocated_memory	= 0;
+ulint	mem_current_allocated_memory	= 0;
 static ulint	mem_max_allocated_memory	= 0;

 /* Size of the hash table for memory management tracking */


Problem: We would like to use tabs in ZPL configs.

Solution: Add the support, count tab as 1 level / 4 spaces.

Signed-off-by: Jana Rapava <f5aec1d7fc977bf55f7b46adac81ba9961638722@eaton.com>

--- src/zconfig.c
+++ src/zconfig.c
@@ -736,11 +736,18 @@
 s_collect_level (char **start, int lineno)
 {
     char *readptr = *start;
-    while (*readptr == ' ')
+    int spaces = 0;
+    int tabs = 0;
+    while (*readptr == ' ' || *readptr == '\t') {
+        if (*readptr == ' ')
+            spaces++;
+        else
+            tabs++;
         readptr++;
-    ptrdiff_t level = (readptr - *start) / 4;
-    if (level * 4 != readptr - *start) {
-        zclock_log ("E (zconfig): (%d) indent 4 spaces at once", lineno);
+    }
+    ptrdiff_t level = (spaces + 4*tabs) / 4;
+    if (level * 4 != spaces + 4*tabs) {
+        zclock_log ("E (zconfig): (%d) indent 4 spaces at once or use tabs", lineno);
         level = -1;
     }
     *start = readptr;


* libsvn_fs/id.c: Don't #include "fs.h".  This file is independent of
the rest of the filesystem code.
(svn_fs_parse_id): Replace use of NEWARRAY with a direct call to apr_palloc.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@838154 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_fs/id.c
+++ subversion/libsvn_fs/id.c
@@ -16,7 +16,6 @@

 #include "svn_fs.h"
 #include "id.h"
-#include "fs.h"
 #include "convert-size.h"

 @@ -214,9 +213,9 @@
       return 0;
   }

-  /* Allocate the ID array.  */
-  /* NOTE: if pool == NULL, then this memory will be malloc'd */
-  id = NEWARRAY (pool, svn_fs_id_t, id_len + 1);
+  /* Allocate the ID array.  Note that if pool is zero, apr_palloc
+     just calls malloc, which meets our promised interface.  */
+  id = apr_palloc (pool, sizeof (*id) * (id_len + 1));

   {
     int i = 0;


Refactored the main tracing code

Refactored the main tracing code

--- srcs/strace.c
+++ srcs/strace.c
@@ -5,46 +5,83 @@
 #include <sys/wait.h>

 #include <sys/ptrace.h>
-#include <sys/reg.h>

+#include "strace.h"
+#include "path.h"
+#include "log.h"
 #include "error.h"

 extern char **environ;

+static int wait_for_syscall_trap(pid_t pid, int *status)
+{
+    int sig_num;
+
+    for (;;) {
+        (void)ptrace(PTRACE_SYSCALL, pid, NULL, NULL);
+        if (waitpid(pid, status, 0) == -1)
+            return (1);
+
+        if (WIFSTOPPED(*status)) {
+            sig_num = WSTOPSIG(*status);
+            if (sig_num & SYSCALL_TRAP_MASK)
+                return (0);
+        }
+        else if (WIFEXITED(status))
+            return (1);
+    }
+}
+
+int trace_process(pid_t pid)
+{
+    int last_status;
+    int exit_code;
+
+    /* Become a tracer */
+    if (ptrace(PTRACE_SEIZE, pid, NULL, PTRACE_OPTIONS))
+        fatal(ERR_PTRACE_SEIZE);
+    /* Trace until exited */
+    for (;;) {
+        /* First trap: before effectively executing the syscall */
+        if (wait_for_syscall_trap(pid, &last_status))
+            break ;
+        else
+            show_syscall_invocation(pid);
+        /* Second trap: after the syscall has been executed */
+        if (wait_for_syscall_trap(pid, &last_status)) {
+            fprintf(stderr, " = ?\n"); /* Too late to peek the return value */
+            break ;
+        }
+        else
+            show_syscall_return_value(pid);
+    }
+
+    exit_code = WEXITSTATUS(last_status);
+    fprintf(stderr, EXIT_MESSAGE, exit_code);
+    return (exit_code);
+}
+
 int strace(char **command)
 {
+    char *program;
     pid_t pid;
+    int exit_code;
+
+    exit_code = 0;
+    program = resolve_program_path(command[0]);
+    if (!program)
+        fatal(ERR_STAT);

     pid = fork();
     if (pid == -1)
-        fatal("Fork failed");
+        fatal(ERR_FORK);
     else if (pid == 0) {
-        kill(getpid(), SIGSTOP);
-        execve(command[0], command, environ);
-        fatal("exec failed");
+        kill(getpid(), SIGSTOP); /* Waiting to be traced by the parent */
+        execve(program, command, environ);
+        fatal(ERR_EXEC);
     }
-    else {
-        ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_TRACESYSGOOD);
-        int i = 0;
-        for(;;) {
-
-            for (;;) {
-                ptrace(PTRACE_SYSCALL, pid, 0, 0);
-                int status;
-                waitpid(pid, &status, 0);
-                if (WIFSTOPPED(status) && WSTOPSIG(status) & 0x80)
-                    break ;
-                else if (WIFEXITED(status))
-                    return(0);
-            }
+    else
+        exit_code = trace_process(pid);

-            int syscall = ptrace(
-                PTRACE_PEEKUSER,
-                pid,
-                sizeof(long)* (i++ % 2 ? RAX : ORIG_RAX)
-            );
-            printf(i % 2 ? "syscall(%d) = " : "%x\n", syscall);
-        }
-    }
-    return (0);
+    return (exit_code);
 }


On branch tc_url_rev: Output change on merge tree-conflicts.

* subversion/svn/info-cmd.c (print_info):
    For a merge, say "Merge left" and "Merge right" instead of "Older"- and
    "Their version".

git-svn-id: 3ab91678e1de23ff380d5f775c015848ab67cc9d@874429 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svn/info-cmd.c
+++ subversion/svn/info-cmd.c
@@ -443,10 +443,24 @@
         svn_cl__node_description(info->tree_conflict->their_version, pool);

       svn_cmdline_printf(pool,
-                         _("Tree conflict: %s\n"
-                           "  Older version: %s\n"
-                           "  Their version: %s"),
-                         desc, older_version, their_version);
+                         "%s: %s\n"
+                         "  %s: %s\n"
+                         "  %s: %s",
+                         _("Tree conflict"),
+                         desc,
+                         (info->tree_conflict->operation
+                            == svn_wc_operation_merge)
+                           ? _("Merge  left") /* (1) */
+                           : _("Older version"),
+                         older_version,
+                         (info->tree_conflict->operation
+                            == svn_wc_operation_merge)
+                           ? _("Merge right")
+                           : _("Their version"),
+                         their_version);
+      /* (1): Sneaking in a space in "Merge  left" so that it is the
+       * same length as "Merge right" while it still starts in the same
+       * column. That's just a tiny tweak in the English `svn'. */
     }

   /* Print extra newline separator. */


Made tag struct contents private

Made tag struct contents private

New functions `mpack_tag_make_*()` are used to generate tags, and other `mpack_tag_*()` functions are used to query a tag's contents.

The mpack_tag_t struct layout has been preserved (aside from ext data) to maintain backwards-compatibility. New code should not directly access the struct contents.

--- src/mpack/mpack-common.h
+++ src/mpack/mpack-common.h
@@ -190,48 +190,66 @@
  *
  * If the type is compound (str, bin, ext, array or map), the embedded data is
  * stored separately.
- */
-typedef struct mpack_tag_t {
-    /** The value for non-compound types. */
+ *
+ * This structure is opaque; its fields should not be accessed outside
+ * of MPack.
+ */
+typedef struct mpack_tag_t mpack_tag_t;
+
+/* Hide internals from documentation */
+/** @cond */
+struct mpack_tag_t {
+    /* The value for non-compound types. */
     union
     {
-        uint64_t u; /**< The value if the type is unsigned int. */
-        int64_t  i; /**< The value if the type is signed int. */
-        double   d; /**< The value if the type is double. */
-        float    f; /**< The value if the type is float. */
-        bool     b; /**< The value if the type is bool. */
-
-        /** The number of bytes if the type is a str or bin. */
+        uint64_t u; /*< The value if the type is unsigned int. */
+        int64_t  i; /*< The value if the type is signed int. */
+        double   d; /*< The value if the type is double. */
+        float    f; /*< The value if the type is float. */
+        bool     b; /*< The value if the type is bool. */
+
+        /* The number of bytes if the type is a str or bin. */
         uint32_t l;

-        /** The element count if the type is an array, or the number of
+        /* The element count if the type is an array, or the number of
             key/value pairs if the type is map. */
         uint32_t n;

-        /**
+        /*
          * The extension data if the type is @ref mpack_type_ext.
          */
         struct {
-            int8_t exttype; /**< The extension type. */
-            uint32_t length; /**< The number of bytes. */
+            int8_t exttype; /*< The extension type. */
+            uint32_t length; /*< The number of bytes. */
         } ext;
     } v;

-    /** The type of value. */
+    /* The type of value. */
     mpack_type_t type;
-} mpack_tag_t;
-
+};
+/** @endcond */
+
+/**
+ * @name Tag Generators
+ * @{
+ */
+
+/**
+ * An @ref mpack_tag_t initializer that zeroes the given tag.
+ *
+ * This does not make the tag nil! The tag's type is invalid when initialized this way.
+ */
 #define MPACK_TAG_ZERO {{0}, (mpack_type_t)0}

 /** Generates a nil tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_nil(void) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_nil(void) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_nil;
     return ret;
 }

 /** Generates a bool tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_bool(bool value) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_bool(bool value) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_bool;
     ret.v.b = value;
@@ -239,7 +257,7 @@
 }

 /** Generates a bool tag with value true. */
-MPACK_INLINE mpack_tag_t mpack_tag_true(void) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_true(void) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_bool;
     ret.v.b = true;
@@ -247,7 +265,7 @@
 }

 /** Generates a bool tag with value false. */
-MPACK_INLINE mpack_tag_t mpack_tag_false(void) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_false(void) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_bool;
     ret.v.b = false;
@@ -255,7 +273,7 @@
 }

 /** Generates a signed int tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_int(int64_t value) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_int(int64_t value) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_int;
     ret.v.i = value;
@@ -263,7 +281,7 @@
 }

 /** Generates an unsigned int tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_uint(uint64_t value) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_uint(uint64_t value) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_uint;
     ret.v.u = value;
@@ -271,7 +289,7 @@
 }

 /** Generates a float tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_float(float value) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_float(float value) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_float;
     ret.v.f = value;
@@ -279,7 +297,7 @@
 }

 /** Generates a double tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_double(double value) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_double(double value) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_double;
     ret.v.d = value;
@@ -287,45 +305,187 @@
 }

 /** Generates an array tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_array(int32_t count) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_array(uint32_t count) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_array;
-    ret.v.n = (uint32_t)count;
+    ret.v.n = count;
     return ret;
 }

 /** Generates a map tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_map(int32_t count) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_map(uint32_t count) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_map;
-    ret.v.n = (uint32_t)count;
+    ret.v.n = count;
     return ret;
 }

 /** Generates a str tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_str(int32_t length) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_str(uint32_t length) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_str;
-    ret.v.l = (uint32_t)length;
+    ret.v.l = length;
     return ret;
 }

 /** Generates a bin tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_bin(int32_t length) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_bin(uint32_t length) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_bin;
-    ret.v.l = (uint32_t)length;
+    ret.v.l = length;
     return ret;
 }

 /** Generates an ext tag. */
-MPACK_INLINE mpack_tag_t mpack_tag_ext(int8_t exttype, int32_t length) {
+MPACK_INLINE mpack_tag_t mpack_tag_make_ext(int8_t exttype, uint32_t length) {
     mpack_tag_t ret = MPACK_TAG_ZERO;
     ret.type = mpack_type_ext;
     ret.v.ext.exttype = exttype;
-    ret.v.ext.length = (uint32_t)length;
-    return ret;
-}
+    ret.v.ext.length = length;
+    return ret;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @name Tag Querying Functions
+ * @{
+ */
+
+/**
+ * Gets the type of a tag.
+ */
+MPACK_INLINE mpack_type_t mpack_tag_type(mpack_tag_t* tag) {
+    return tag->type;
+}
+
+/**
+ * Gets the boolean value of a bool-type tag. The tag must be of type @ref
+ * mpack_type_bool.
+ */
+MPACK_INLINE bool mpack_tag_bool_value(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_bool, "tag is not a bool!");
+    return tag->v.b;
+}
+
+/**
+ * Gets the signed integer value of an int-type tag.
+ *
+ * This does not convert between signed and unsigned tags! A positive integer may be stored in a tag as either @ref mpack_type_int or @ref mpack_type_uint. You must check the type first; this can only be used if the type is @ref mpack_type_int.
+ *
+ * @see mpack_type_int
+ */
+MPACK_INLINE int64_t mpack_tag_int_value(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_int, "tag is not an int!");
+    return tag->v.i;
+}
+
+/**
+ * Gets the unsigned integer value of an uint-type tag.
+ *
+ * This does not convert between signed and unsigned tags! A positive integer may be stored in a tag as either @ref mpack_type_int or @ref mpack_type_uint. You must check the type first; this can only be used if the type is @ref mpack_type_uint.
+ *
+ * @see mpack_type_uint
+ */
+MPACK_INLINE uint64_t mpack_tag_uint_value(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_uint, "tag is not a uint!");
+    return tag->v.u;
+}
+
+/**
+ * Gets the float value of a float-type tag.
+ *
+ * This does not convert between float and double tags. This can only be used if the type is @ref mpack_type_float.
+ *
+ * @see mpack_type_float
+ */
+MPACK_INLINE float mpack_tag_float_value(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_float, "tag is not a float!");
+    return tag->v.f;
+}
+
+/**
+ * Gets the double value of a double-type tag.
+ *
+ * This does not convert between float and double tags. This can only be used if the type is @ref mpack_type_double.
+ *
+ * @see mpack_type_double
+ */
+MPACK_INLINE double mpack_tag_double_value(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_double, "tag is not a double!");
+    return tag->v.d;
+}
+
+/**
+ * Gets the number of elements in an array tag.
+ *
+ * @see mpack_type_array
+ */
+MPACK_INLINE uint32_t mpack_tag_array_count(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_array, "tag is not an array!");
+    return tag->v.n;
+}
+
+/**
+ * Gets the number of key-value pairs in a map tag.
+ *
+ * @see mpack_type_map
+ */
+MPACK_INLINE uint32_t mpack_tag_map_count(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_map, "tag is not a map!");
+    return tag->v.n;
+}
+
+/**
+ * Gets the length in bytes of a str-type tag.
+ *
+ * @see mpack_type_str
+ */
+MPACK_INLINE uint32_t mpack_tag_str_length(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_str, "tag is not a str!");
+    return tag->v.l;
+}
+
+/**
+ * Gets the length in bytes of a bin-type tag.
+ *
+ * @see mpack_type_bin
+ */
+MPACK_INLINE uint32_t mpack_tag_bin_length(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_bin, "tag is not a bin!");
+    return tag->v.l;
+}
+
+/**
+ * Gets the length in bytes of an ext-type tag.
+ *
+ * @see mpack_type_ext
+ */
+MPACK_INLINE uint32_t mpack_tag_ext_length(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_ext, "tag is not an ext!");
+    return tag->v.ext.length;
+}
+
+/**
+ * Gets the extension type (exttype) of an ext-type tag.
+ *
+ * @see mpack_type_ext
+ */
+MPACK_INLINE int8_t mpack_tag_ext_exttype(mpack_tag_t* tag) {
+    mpack_assert(tag->type == mpack_type_ext, "tag is not an ext!");
+    return tag->v.ext.exttype;
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @name other tag functions
+ * @{
+ */

 /**
  * Compares two tags with an arbitrary fixed ordering. Returns 0 if the tags are
@@ -385,7 +545,89 @@
  * @}
  */

-
+/**
+ * @name Deprecated Tag Generators
+ * @{
+ */
+
+/*
+ * "make" has been added to their names to disambiguate them from the
+ * value-fetching functions (e.g. mpack_tag_make_bool() vs
+ * mpack_tag_bool_value().)
+ *
+ * The length and count for all compound types was the wrong sign (int32_t
+ * instead of uint32_t.) These preserve the old behaviour; the new "make"
+ * functions have the correct sign.
+ */
+
+/** \deprecated Renamed to mpack_tag_make_nil(). */
+MPACK_INLINE mpack_tag_t mpack_tag_nil(void) {
+    return mpack_tag_make_nil();
+}
+
+/** \deprecated Renamed to mpack_tag_make_bool(). */
+MPACK_INLINE mpack_tag_t mpack_tag_bool(bool value) {
+    return mpack_tag_make_bool(value);
+}
+
+/** \deprecated Renamed to mpack_tag_make_true(). */
+MPACK_INLINE mpack_tag_t mpack_tag_true(void) {
+    return mpack_tag_make_true();
+}
+
+/** \deprecated Renamed to mpack_tag_make_false(). */
+MPACK_INLINE mpack_tag_t mpack_tag_false(void) {
+    return mpack_tag_make_false();
+}
+
+/** \deprecated Renamed to mpack_tag_make_int(). */
+MPACK_INLINE mpack_tag_t mpack_tag_int(int64_t value) {
+    return mpack_tag_make_int(value);
+}
+
+/** \deprecated Renamed to mpack_tag_make_uint(). */
+MPACK_INLINE mpack_tag_t mpack_tag_uint(uint64_t value) {
+    return mpack_tag_make_uint(value);
+}
+
+/** \deprecated Renamed to mpack_tag_make_float(). */
+MPACK_INLINE mpack_tag_t mpack_tag_float(float value) {
+    return mpack_tag_make_float(value);
+}
+
+/** \deprecated Renamed to mpack_tag_make_double(). */
+MPACK_INLINE mpack_tag_t mpack_tag_double(double value) {
+    return mpack_tag_make_double(value);
+}
+
+/** \deprecated Renamed to mpack_tag_make_array(). */
+MPACK_INLINE mpack_tag_t mpack_tag_array(int32_t count) {
+    return mpack_tag_make_array((uint32_t)count);
+}
+
+/** \deprecated Renamed to mpack_tag_make_map(). */
+MPACK_INLINE mpack_tag_t mpack_tag_map(int32_t count) {
+    return mpack_tag_make_map((uint32_t)count);
+}
+
+/** \deprecated Renamed to mpack_tag_make_str(). */
+MPACK_INLINE mpack_tag_t mpack_tag_str(int32_t length) {
+    return mpack_tag_make_str((uint32_t)length);
+}
+
+/** \deprecated Renamed to mpack_tag_make_bin(). */
+MPACK_INLINE mpack_tag_t mpack_tag_bin(int32_t length) {
+    return mpack_tag_make_bin((uint32_t)length);
+}
+
+/** \deprecated Renamed to mpack_tag_make_ext(). */
+MPACK_INLINE mpack_tag_t mpack_tag_ext(int8_t exttype, int32_t length) {
+    return mpack_tag_make_ext(exttype, (uint32_t)length);
+}
+
+/**
+ * @}
+ */

 /** @cond */


* subversion/svnlook/main.c

* subversion/svnlook/main.c

  (contents_to_tmp_file): Create tmp files based on the basenames of
  the originals, not the full paths.

  (print_diff_tree): Print "Added", "Deleted", or "Modified" instead
  of "Index" in the headers of file diffs for whom we know the
  relevant action.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@839872 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnlook/main.c
+++ subversion/svnlook/main.c
@@ -309,10 +309,17 @@
   apr_status_t apr_err;
   svn_stringbuf_t *prefix;
   svn_stringbuf_t *d, *b;
-
-  svn_path_split (path, &d, &b, svn_path_repos_style, pool);
-  prefix = svn_stringbuf_create
-    (apr_psprintf (pool, "tmp.%s", b ? b->data : "null"), pool);
+
+  if (path)
+    {
+      svn_path_split (path, &d, &b, svn_path_repos_style, pool);
+      prefix = svn_stringbuf_create
+        (apr_psprintf (pool, "tmp.%s", b ? b->data : "null"), pool);
+    }
+  else
+    {
+      prefix = svn_stringbuf_create ("tmp.null", pool);
+    }

   /* Open a unique file.  We'll be dumping the contents of the
      current file there. */
@@ -395,7 +402,11 @@
                                                    " -u %s %s",
                                                    fname2->data,
                                                    fname1->data));
-      printf ("Index: %s\n", path->data);
+      printf ("%s: %s\n",
+              ((tmp_node->action == 'A') ? "Added" :
+               ((tmp_node->action == 'D') ? "Deleted" :
+                ((tmp_node->action == 'R') ? "Modified" : "Index"))),
+              path->data);
       printf ("===============================================================\
 ===============\n");
       fflush (stdout);


Bumped version to 0.7.1

Bumped version to 0.7.1

--- src/mpack/mpack-common.h
+++ src/mpack/mpack-common.h
@@ -38,7 +38,7 @@

 #define MPACK_VERSION_MAJOR 0  /**< The major version number of MPack. */
 #define MPACK_VERSION_MINOR 7  /**< The minor version number of MPack. */
-#define MPACK_VERSION_PATCH 0  /**< The patch version number of MPack. */
+#define MPACK_VERSION_PATCH 1  /**< The patch version number of MPack. */

 /** A number containing the version number of MPack for comparison purposes. */
 #define MPACK_VERSION ((MPACK_VERSION_MAJOR * 10000) + \


Initialize outlen.

Initialize outlen.

--- ssl/s3_srvr.c
+++ ssl/s3_srvr.c
@@ -2504,7 +2504,7 @@
 			EVP_PKEY_CTX *pkey_ctx;
 			EVP_PKEY *client_pub_pkey = NULL;
 			unsigned char premaster_secret[32], *start;
-			size_t outlen, inlen;
+			size_t outlen=32, inlen;

 			/* Get our certificate private key*/
 			pkey_ctx = EVP_PKEY_CTX_new(s->cert->key->privatekey,NULL);


Fix SSLv2-compatible ClientHello processing.

If the client challenge is less than 32 bytes, it is padded with leading - not trailing - zero bytes.

Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>

--- ssl/s3_srvr.c
+++ ssl/s3_srvr.c
@@ -1057,7 +1057,9 @@
         /* Load the client random */
         i = (cl > SSL3_RANDOM_SIZE) ? SSL3_RANDOM_SIZE : cl;
         memset(s->s3->client_random, 0, SSL3_RANDOM_SIZE);
-        if (!PACKET_peek_copy_bytes(&pkt, s->s3->client_random, i)
+        if (!PACKET_peek_copy_bytes(&pkt,
+                                    s->s3->client_random + SSL3_RANDOM_SIZE - i,
+                                    i)
                 || !PACKET_forward(&pkt, cl)
                 || PACKET_remaining(&pkt) != 0) {
             SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_RECORD_LENGTH_MISMATCH);


Fixed memory leak in the event of a failure of BUF_MEM_grow

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>

--- ssl/s3_srvr.c
+++ ssl/s3_srvr.c
@@ -294,6 +294,7 @@
 					}
 				if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
 					{
+					BUF_MEM_free(buf);
 					ret= -1;
 					goto end;
 					}


Code Styling

Code Styling

git-svn-id: 3d54f09c3274966c78a0b0842e411ae2b9b02a46@498 5b3c568a-86f9-4a59-a47a-7be284f604b4

--- src/wfs/wfs_transaction.c
+++ src/wfs/wfs_transaction.c
@@ -657,9 +657,7 @@
                 buffer_free(where);
                 buffer_free(sql);
                 buffer_free(layer_name);
-                wfs_error(o, wr, WFS_ERROR_NO_MATCHING,
-                          "error : an id_column is required to use featureid",
-                          "Delete");
+                wfs_error(o, wr, WFS_ERROR_NO_MATCHING, "error : an id_column is required to use featureid", "Delete");
                 return;
             }
         }


Btrfs: actually limit the size of delalloc range

So forever we have had this thing to limit the amount of delalloc pages we'll
setup to be written out to 128mb.  This is because we have to lock all the pages
in this range, so anything above this gets a bit unweildly, and also without a
limit we'll happily allocate gigantic chunks of disk space.  Turns out our check
for this wasn't quite right, we wouldn't actually limit the chunk we wanted to
write out, we'd just stop looking for more space after we went over the limit.
So if you do a giant 20gb dd on my box with lots of ram I could get 2gig
extents.  This is fine normally, except when you go to relocate these extents
and we can't find enough space to relocate these moster extents, since we have
to be able to allocate exactly the same sized extent to move it around.  So fix
this by actually enforcing the limit.  With this patch I'm no longer seeing
giant 1.5gb extents.  Thanks,

Signed-off-by: Josef Bacik <631dfb3d07694fdcf26abc7aac2c6c2b641f8bde@fusionio.com>
Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@fusionio.com>

--- fs/btrfs/extent_io.c
+++ fs/btrfs/extent_io.c
@@ -1481,10 +1481,12 @@
 		*end = state->end;
 		cur_start = state->end + 1;
 		node = rb_next(node);
+		total_bytes += state->end - state->start + 1;
+		if (total_bytes >= max_bytes) {
+			*end = *start + max_bytes - 1;
+			break;
+		}
 		if (!node)
-			break;
-		total_bytes += state->end - state->start + 1;
-		if (total_bytes >= max_bytes)
 			break;
 	}
 out:


Corrected file for SAMD51 build

Corrected file for SAMD51 build

--- ports/atmel-samd/supervisor/port.c
+++ ports/atmel-samd/supervisor/port.c
@@ -91,8 +91,8 @@
 #if CIRCUITPY_PEW
 #include "common-hal/_pew/PewPew.h"
 #endif
+volatile bool hold_interrupt = false;
 #ifdef SAMD21
-volatile bool hold_interrupt = false;

 void rtc_start_pulsein(void) {
     rtc_set_continuous();


Fixes for string-set!

Fixes for string-set!

Handle setting of a char to one that is represented using fewer bytes.

--- runtime.c
+++ runtime.c
@@ -2139,39 +2139,35 @@

   Cyc_check_bounds(data, "string-set!", len, idx);

-  // Take fast path if all chars are just 1 byte
   if (string_num_cp(str) == string_len(str) && buf_len == 1) {
+    // Take fast path if all chars are just 1 byte
     raw[idx] = obj_obj2char(chr);
   } else {
-fprintf(stderr, "DEBUG %s, num_cp = %d, len = %d\n", raw, string_num_cp(str), len);
-    // TODO: utf8 support
-    // find codepoint at k, figure out how many bytes it is,
-    // allocate a new string (start) + chr + (end)
-    // or don't allocate if chr uses as many or fewer bytes
-    // than the codepoint it is replacing
-
+    // Slower path for UTF-8, need to handle replacement differently
+    // depending upon how the new char affects length of the string
     char *tmp = raw, *this_cp = raw;
     char_type codepoint;
     uint32_t state = 0;
-    int i = 0, count, bytes = 0;
+    int i = 0, count, prev_cp_bytes = 0, cp_idx;

     for (count = 0; *tmp; ++tmp){
-      bytes++;
+      prev_cp_bytes++;
       if (!Cyc_utf8_decode(&state, &codepoint, (uint8_t)*tmp)){
         if (count == idx) {
           break;
         }
         this_cp = tmp + 1;
         count += 1;
-        bytes = 0;
+        prev_cp_bytes = 0;
       }
       i++;
     }
+    cp_idx = i;
     if (state != CYC_UTF8_ACCEPT) {
        Cyc_rt_raise2(data, "string-set! - invalid character at index", k);
     }

-    // TODO: perform actual mutation
+    // Perform actual mutation
     //
     // Now we know length of start (both in codepoints and bytes),
     // and we know the codepoint to be replaced. by calculating its length
@@ -2179,22 +2175,26 @@
     // figure out how many remaining bytes/codepoints are in end
     //
     // 3 cases:
-    // - buf_len = bytes, just straight replace
-    if (buf_len == bytes) {
+    // - 1) buf_len = prev_cp_bytes, just straight replace
+    if (buf_len == prev_cp_bytes) {
       for (i = 0; i < buf_len; i++) {
         this_cp[i] = buf[i];
       }
     }
-    // - buf_len > bytes, will need to allocate more memory (!!)
-    // - buf_len < bytes, just replace, but pad with NULL chars.
-    //                    in this case need to ensure string_len is not
-    //                    reduced because original value still matters for GC purposes
-    //else if (buf_len < bytes) {
-    //  for (i = 0; i < buf_len; i++) {
-    //    this_cp[i] = buf[i];
-    //  }
-    // TODO: memcpy remaining string, ensure trailing null is setup correctly, consolidate with above??
-    //}
+    // - 2) buf_len < prev_cp_bytes, replace and shift chars down
+    else if (buf_len < prev_cp_bytes) {
+      // Replace code point with shorter one
+      for (i = 0; i < buf_len; i++) {
+        this_cp[i] = buf[i];
+      }
+      // Move string down to eliminate unneeded chars
+      memmove(this_cp + buf_len, this_cp + prev_cp_bytes, len - cp_idx);
+      // Null terminate the shorter string.
+      // Ensure string_len is not reduced because original
+      // value still matters for GC purposes
+      raw[len - (prev_cp_bytes - buf_len)] = '\0';
+    }
+    // - 3) TODO: buf_len > prev_cp_bytes, will need to allocate more memory (!!)
     else {
       Cyc_rt_raise2(data, "string-set! - unable to modify character", chr);
     }


fix previous modification -- if ssl->cert is NULL, don't follow the pointer.

--- ssl/ssl_lib.c
+++ ssl/ssl_lib.c
@@ -575,6 +575,8 @@
 		SSLerr(SSL_F_SSL_CHECK_PRIVATE_KEY,ERR_R_PASSED_NULL_PARAMETER);
 		return(0);
 		}
+	if (ssl->cert == NULL)
+		return 0;
 	if (ssl->cert->key->x509 == NULL)
 		{
 		SSLerr(SSL_F_SSL_CHECK_PRIVATE_KEY,SSL_R_NO_CERTIFICATE_ASSIGNED);


linux/open_by_handle: don't fail hard if the libc is incomplete

--- linux/open_by_handle.c
+++ linux/open_by_handle.c
@@ -109,7 +109,8 @@
 #else /* MAX_HANDLE_SZ */
 int main(void)
 {
-    fprintf(stderr, "name_to_handle_at and open_by_handle_at seem to be unsupported by your libc.\n");
-    return 1;
+    printf("name_to_handle_at and open_by_handle_at seem to be unsupported by your libc.\n");
+    /* Return success so that "make test" doesn't fail with a libc like musl */
+    return 0;
 }
 #endif /* MAX_HANDLE_SZ */


Fix 1cb5168

Fix 1cb5168

--- src/net/core/neighbour.c
+++ src/net/core/neighbour.c
@@ -109,21 +109,18 @@

 	if (ptr.lh == &used_neighbours_list) { /* if not found then alloc new */
 		ptr.v = pool_alloc(&neighbour_pool);
-
-		list_add_tail(ptr.lh, &used_neighbours_list);
-
 		if (ptr.v == NULL) {
-			return -ENOMEM;
+      return -ENOMEM;
 		}
-		entity = &ptr.nh->n;
-	}
+  	list_add_tail(ptr.lh, &used_neighbours_list);
+  	entity = &ptr.nh->n;
+ 	}

 	ptr.nh->ctime = 0;
 	memcpy(entity->hw_addr, hw_addr, ETH_ALEN);
 	entity->if_handler = if_handler;
 	entity->ip_addr = ip_addr;
 	entity->flags = flags;
-

 	return ENOERR;
 }
@@ -188,11 +185,5 @@
 }

 static int unit_init(void) {
-	int res;
-
-	res = timer_set(&neighbour_refresh_timer, NEIGHBOUR_CHECK_INTERVAL, neighbour_refresh, NULL);
-	if (res < 0) {
-		return res;
-	}
-	return ENOERR;
-}
+	return timer_set(&neighbour_refresh_timer, NEIGHBOUR_CHECK_INTERVAL, neighbour_refresh, NULL);
+ }


btrfs: Remove set bits return from clear_extent_bit

There is only one caller of clear_extent_bit that checks the return value
and it only checks if it's negative. Since there are no users of the
returned bits functionality of clear_extent_bit, stop returning it
and avoid complicating error handling.

Signed-off-by: Jeff Mahoney <5459ed423adecc5a7fe2249dd619058acc25c497@suse.com>

--- fs/btrfs/extent_io.c
+++ fs/btrfs/extent_io.c
@@ -462,8 +462,7 @@
  *
  * the range [start, end] is inclusive.
  *
- * This takes the tree lock, and returns < 0 on error, > 0 if any of the
- * bits were already set, or zero if none of the bits were already set.
+ * This takes the tree lock, and returns 0 on success and < 0 on error.
  */
 int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
 		     int bits, int wake, int delete,
@@ -477,7 +476,6 @@
 	struct rb_node *node;
 	u64 last_end;
 	int err;
-	int set = 0;
 	int clear = 0;

 	if (delete)
@@ -562,7 +560,7 @@
 		if (err)
 			goto out;
 		if (state->end <= end) {
-			set |= clear_state_bit(tree, state, &bits, wake);
+			clear_state_bit(tree, state, &bits, wake);
 			if (last_end == (u64)-1)
 				goto out;
 			start = last_end + 1;
@@ -585,13 +583,13 @@
 		if (wake)
 			wake_up(&state->wq);

-		set |= clear_state_bit(tree, prealloc, &bits, wake);
+		clear_state_bit(tree, prealloc, &bits, wake);

 		prealloc = NULL;
 		goto out;
 	}

-	set |= clear_state_bit(tree, state, &bits, wake);
+	clear_state_bit(tree, state, &bits, wake);
 next:
 	if (last_end == (u64)-1)
 		goto out;
@@ -608,7 +606,7 @@
 	if (prealloc)
 		free_extent_state(prealloc);

-	return set;
+	return 0;

 search_again:
 	if (start > end)


fixing broken build by commenting out C++ code in progress - oops

--- packages/nimble/inst/include/nimble/nimbleEigenNimArr.h
+++ packages/nimble/inst/include/nimble/nimbleEigenNimArr.h
@@ -94,38 +94,38 @@
 }

-template<typename NimArrOutput, typename NimArrInput>
-  void setSizeNimArrToNimArr(NimArrOutput &target, NimArrInput &input, copyValues = true, bool fillZeros = true ) {
-  if(target.isMap()) {
-    _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with a map.\n"; nimble_print_to_R( _nimble_global_output);
-    return;
-  }
-  if(input.numDims() != 1) {
-    _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with input that is not 1-dimensional.\n"; nimble_print_to_R( _nimble_global_output);
-  }
-  if(input.size() != target.numDims()) {
-    _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with wrong number of dimensions provided.\n"; nimble_print_to_R( _nimble_global_output);
-  }
-  switch(target.numDims()) {
-  case 1:
-    target.setSize(input[0], copyValues, fillZeros);
-    break;
-  case 2:
-    target.setSize(input[0], input[1], copyValues, fillZeros);
-    break;
-  case 3:
-    target.setSize(input[0], input[1], input[2], copyValues, fillZeros);
-    break;
-  case 4:
-    target.setSize(input[0], input[1], input[2], input[3], copyValues, fillZeros);
-    break;
-  default:
-    _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with invalid number of dimensions.\n"; nimble_print_to_R( _nimble_global_output);
-    break;
-  }
-
-  return;
-}
+/* template<typename NimArrOutput, typename NimArrInput> */
+/*   void setSizeNimArrToNimArr(NimArrOutput &target, NimArrInput &input, bool copyValues = true, bool fillZeros = true ) { */
+/*   if(target.isMap()) { */
+/*     _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with a map.\n"; nimble_print_to_R( _nimble_global_output); */
+/*     return; */
+/*   }  */
+/*   if(input.numDims() != 1) { */
+/*     _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with input that is not 1-dimensional.\n"; nimble_print_to_R( _nimble_global_output); */
+/*   } */
+/*   if(input.size() != target.numDims()) { */
+/*     _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with wrong number of dimensions provided.\n"; nimble_print_to_R( _nimble_global_output); */
+/*   } */
+/*   switch(target.numDims()) { */
+/*   case 1: */
+/*     target.setSize(input[0], copyValues, fillZeros); */
+/*     break; */
+/*   case 2: */
+/*     target.setSize(input[0], input[1], copyValues, fillZeros); */
+/*     break; */
+/*   case 3: */
+/*     target.setSize(input[0], input[1], input[2], copyValues, fillZeros); */
+/*     break; */
+/*   case 4: */
+/*     target.setSize(input[0], input[1], input[2], input[3], copyValues, fillZeros); */
+/*     break; */
+/*   default: */
+/*     _nimble_global_output << "Error from C++: using setSizeNimArrToNimArr with invalid number of dimensions.\n"; nimble_print_to_R( _nimble_global_output); */
+/*     break; */
+/*   } */
+
+/*   return; */
+/* } */

 template<typename NimArrOutput, typename NimArrInput>


fix template specialization in a different namespace


Issue #69 - Removed symtbl size checks

Issue #69 - Removed symtbl size checks

libck already does this internally

--- runtime.c
+++ runtime.c
@@ -124,7 +124,7 @@

 const object Cyc_EOF = &__EOF;
 static ck_hs_t symbol_table;
-static int symbol_table_size = 65536;
+static int symbol_table_initial_size = 4096;
 static pthread_mutex_t symbol_table_lock;

 // Functions to support concurrency kit hashset
@@ -192,7 +192,7 @@
   if (!ck_hs_init(&symbol_table,
                   CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
                   hs_hash, hs_compare,
-                  &my_allocator, symbol_table_size, 43423)) {
+                  &my_allocator, symbol_table_initial_size, 43423)) {
     fprintf(stderr, "Unable to initialize symbol table\n");
     exit(1);
   }
@@ -289,11 +289,6 @@
 {
   //printf("Adding symbol %s, table size = %ld\n", symbol_pname(psym), ck_hs_count(&symbol_table));
   pthread_mutex_lock(&symbol_table_lock);       // Only 1 "writer" allowed
-  if (ck_hs_count(&symbol_table) == symbol_table_size) {
-    // TODO: grow table if it is not big enough
-    fprintf(stderr, "Ran out of symbol table entries\n");
-    exit(1);
-  }
   set_insert(&symbol_table, psym);
   pthread_mutex_unlock(&symbol_table_lock);
   return psym;


correct jargon

correct jargon

--- disorderCook.c
+++ disorderCook.c
@@ -268,7 +268,7 @@
 }

-// strlcpy stolen straight from OpenBSD
+// strlcpy borrowed from OpenBSD
 // Copyright (c) 1998 Todd C. Miller
 //
 // BSD License (as is disorderCook)


Fix for btrfs_find_free_objectid

Fix for btrfs_find_free_objectid

btrfs_find_free_objectid may return a used objectid due to arithmetic
underflow. This bug may happen when parameter 'root' is tree root,  so
it may cause serious problems when creating snapshot or sub-volume.

Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>

--- fs/btrfs/inode-map.c
+++ fs/btrfs/inode-map.c
@@ -62,7 +62,6 @@
 	struct btrfs_path *path;
 	struct btrfs_key key;
 	int ret;
-	u64 hole_size = 0;
 	int slot = 0;
 	u64 last_ino = 0;
 	int start_found;
@@ -109,8 +108,7 @@
 			if (start_found) {
 				if (last_ino < search_start)
 					last_ino = search_start;
-				hole_size = key.objectid - last_ino;
-				if (hole_size > 0) {
+				if (key.objectid > last_ino) {
 					*objectid = last_ino;
 					goto found;
 				}