Don't show spurious details of virtual thing

--- mud/home/Http/lib/bulk.c
+++ mud/home/Http/lib/bulk.c
@@ -5,50 +5,49 @@
 {
 	string buffer;

-	buffer = "\n";
+	if (obj->query_virtual()) {
+		buffer = "Virtual
\n";
+	} else {
+		if (obj->query_flexible()) {
+			buffer += "Flexible
\n";
+		}

-	buffer += "Mass: " + mixed_sprint(obj->query_mass()) + " kg";
+		buffer = "\n";

-	if (obj->query_mass_absolute()) {
-		buffer += " (absolute)
\n";
-	} else {
-		buffer += " (derived, local mass " + mixed_sprint(obj->query_local_mass()) + " kg
\n";
+		buffer += "Mass: " + mixed_sprint(obj->query_mass()) + " kg";
+
+		if (obj->query_mass_absolute()) {
+			buffer += " (absolute)
\n";
+		} else {
+			buffer += " (derived, local mass " + mixed_sprint(obj->query_local_mass()) + " kg
\n";
+		}
+
+		buffer += "Density: " + mixed_sprint(obj->query_density()) + " kg/l";
+
+		if (obj->query_density_absolute()) {
+			buffer += " (absolute)
\n";
+		} else {
+			buffer += " (derived, local density " + mixed_sprint(obj->query_local_density()) + " kg/l)
\n";
+		}
+
+		buffer += "Capacity: " + mixed_sprint(obj->query_capacity()) + " m^3";
+
+		if (obj->query_capacity_absolute()) {
+			buffer += " (absolute)
\n";
+		} else {
+			buffer += " (derived, local capacity " + mixed_sprint(obj->query_local_capacity()) + " m^3)
\n";
+		}
+
+		buffer += "Max mass: " + mixed_sprint(obj->query_max_mass()) + " kg";
+
+		if (obj->query_max_mass_absolute()) {
+			buffer += " (absolute)
\n";
+		} else {
+			buffer += " (derived, local max mass " + mixed_sprint(obj->query_local_max_mass()) + " kg)
\n";
+		}
+
+		buffer += "\n";
 	}
-
-
-	buffer += "Density: " + mixed_sprint(obj->query_density()) + " kg/l";
-
-	if (obj->query_density_absolute()) {
-		buffer += " (absolute)
\n";
-	} else {
-		buffer += " (derived, local density " + mixed_sprint(obj->query_local_density()) + " kg/l)
\n";
-	}
-
-	buffer += "Capacity: " + mixed_sprint(obj->query_capacity()) + " m^3";
-
-	if (obj->query_capacity_absolute()) {
-		buffer += " (absolute)
\n";
-	} else {
-		buffer += " (derived, local capacity " + mixed_sprint(obj->query_local_capacity()) + " m^3)
\n";
-	}
-
-	buffer += "Max mass: " + mixed_sprint(obj->query_max_mass()) + " kg";
-
-	if (obj->query_max_mass_absolute()) {
-		buffer += " (absolute)
\n";
-	} else {
-		buffer += " (derived, local max mass " + mixed_sprint(obj->query_local_max_mass()) + " kg)
\n";
-	}
-
-	if (obj->query_virtual()) {
-		buffer += "Virtual
\n";
-	}
-
-	if (obj->query_flexible()) {
-		buffer += "Flexible
\n";
-	}
-
-	buffer += "\n";

 	return oinfobox("Bulk", 3, buffer);
 }


ustawianie errno tam, gdzie nie było ustawiane.

--- src/libgadu.c
+++ src/libgadu.c
@@ -568,6 +568,7 @@
 			}

 			if (e->type == GG_EVENT_CONN_FAILED) {
+				errno = EACCES;
 				gg_debug(GG_DEBUG_MISC, "-- could not login\n");
 				gg_free_event(e);
 				free(sess);
@@ -1018,6 +1019,7 @@
 			if (read(sess->fd, &a, sizeof(a)) < sizeof(a) || a.s_addr == INADDR_NONE) {
 				gg_debug(GG_DEBUG_MISC, "-- resolving failed\n");

+				errno = ENOENT;
 				e->type = GG_EVENT_CONN_FAILED;
 				e->event.failure = GG_FAILURE_RESOLVING;
 				sess->state = GG_STATE_IDLE;
@@ -1101,6 +1103,7 @@
 			if (write(sess->fd, buf, strlen(buf)) < strlen(buf)) {
 				gg_debug(GG_DEBUG_MISC, "-- sending query failed\n");

+				errno = EIO;
 				e->type = GG_EVENT_CONN_FAILED;
 				e->event.failure = GG_FAILURE_WRITING;
 				sess->state = GG_STATE_IDLE;
@@ -1129,6 +1132,7 @@
 			if (strncmp(buf, "HTTP/1.", 7) || strncmp(buf + 9, "200", 3)) {
 				gg_debug(GG_DEBUG_MISC, "-- but that's not what we've expected\n");

+				errno = EINVAL;
 				e->type = GG_EVENT_CONN_FAILED;
 				e->event.failure = GG_FAILURE_INVALID;
 				sess->state = GG_STATE_IDLE;
@@ -1202,7 +1206,6 @@
 				if ((sess->fd = gg_connect(addr, GG_HTTPS_PORT, sess->async)) == -1) {
 				    gg_debug(GG_DEBUG_MISC, "-- connection failed, errno = %d (%s)\n", errno, strerror(errno));

-				    errno = res;
 				    e->type = GG_EVENT_CONN_FAILED;
 				    e->event.failure = GG_FAILURE_CONNECTING;
 				    sess->state = GG_STATE_IDLE;
@@ -1243,6 +1246,7 @@

 				free(h);
 				close(sess->fd);
+				errno = EINVAL;
 				e->type = GG_EVENT_CONN_FAILED;
 				e->event.failure = GG_FAILURE_INVALID;
 				sess->state = GG_STATE_IDLE;
@@ -1317,6 +1321,7 @@
 			} else {
 				gg_debug(GG_DEBUG_MISC, "-- invalid packet\n");
 				e->event.failure = GG_FAILURE_INVALID;
+				errno = EINVAL;
 			}

 			e->type = GG_EVENT_CONN_FAILED;


Fix siteban quit method

Fix siteban quit method

--- mud/home/Text/obj/user.c
+++ mud/home/Text/obj/user.c
@@ -193,7 +193,9 @@
 		{
 			string msg;

-			msg = BAND->check_siteban_message(query_base_conn());
+			msg = BAND->check_siteban_message(query_ip_number(query_base_conn()));
+
+			message("\n\nYou have been sitebanned.\n\n");

 			if (msg) {
 				message(msg + "\n");


[src] Replaced tabs with spaces and removed trailing space as per coding
standards (again)

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

--- src/library.c
+++ src/library.c
@@ -166,16 +166,16 @@

 static const char win32_path_seperator = '\\';

-/*
-   Converts a path with forward slashes to one with backward slashes.
+/*
+   Converts a path with forward slashes to one with backward slashes.
 */
 static void
 cnv_to_win32_filesep ( STRING *path ) {
     char* cnv;
-
+
     assert(path->encoding == Parrot_fixed_8_encoding_ptr ||
         path->encoding == Parrot_utf8_encoding_ptr);
-
+
     while (cnv = strchr(path->strstart, path_seperator))
         *cnv = win32_path_seperator;
 }
@@ -183,7 +183,7 @@
 #endif

 static STRING*
-path_finalize(Interp *interp, STRING *path )
+path_finalize(Interp *interp, STRING *path )
 {

     /* TODO create a string API that just does that
@@ -196,7 +196,7 @@
     path = string_append(interp, path, nul);
     path->bufused--;
     path->strlen--;
-
+
 #ifdef WIN32
     cnv_to_win32_filesep( path );
 #endif
@@ -205,26 +205,26 @@
 }

 /*
-  unary path arguement. the path string will have a
+  unary path arguement. the path string will have a
   trailing path-seperator appended if it is not
   there already.
  */

 static STRING*
-path_garuntee_trailing_seperator(Interp *interp, STRING *path )
+path_garuntee_trailing_seperator(Interp *interp, STRING *path )
 {
     STRING *path_seperator_string = string_chr(interp, path_seperator);

     /* make sure the path has a trailing slash before appending the file */
     if ( string_index(interp, path , path->strlen - 1)
-	 != string_index(interp, path_seperator_string, 0))
-	path = string_append(interp, path , path_seperator_string);
+         != string_index(interp, path_seperator_string, 0))
+        path = string_append(interp, path , path_seperator_string);

     return path;
 }

 /*
-  binary path arguements, the left arg is modified.
+  binary path arguements, the left arg is modified.
   a trailing seperator is garunteed for the left
   arguement and the right arguement is appended
  */
@@ -234,7 +234,7 @@
 {
     l_path = path_garuntee_trailing_seperator(interp, l_path );
     l_path = string_append(interp, l_path , r_path);
-
+
     return l_path;
 }

@@ -248,11 +248,11 @@
 path_concat(Interp *interp, STRING *l_path, STRING *r_path )
 {
     STRING* join;
-
+
     join = string_copy(interp, l_path);
     join = path_garuntee_trailing_seperator(interp, join );
     join = string_append(interp, join , r_path);
-
+
     return join;
 }

@@ -305,14 +305,14 @@
         path = VTABLE_get_string_keyed_int(interp, paths, i);
         if (string_length(interp, prefix) &&
            !is_abs_path(interp,path)) {
- 	    full_name = path_concat(interp, prefix , path );
+            full_name = path_concat(interp, prefix , path );
         }
         else
             full_name = string_copy(interp, path);

- 	full_name = path_append(interp, full_name , file );
-
-	full_name = path_finalize(interp, full_name );
+        full_name = path_append(interp, full_name , file );
+
+        full_name = path_finalize(interp, full_name );
         if (Parrot_stat_info_intval(interp, full_name, STAT_EXISTS)) {
             return full_name;
         }


record serial/parallel process runtime

record serial/parallel process runtime

--- src/libscaf.c
+++ src/libscaf.c
@@ -59,6 +59,10 @@
 float scaf_section_duration;
 float scaf_section_ipc;
 float scaf_section_start_time;
+float scaf_section_end_time;
+
+float scaf_parallel_runtime;
+float scaf_serial_runtime;

 void* current_section_id;
 int current_threads;
@@ -217,6 +221,7 @@
       long long int ins;
       int ret = PAPI_ipc(&rtime, &ptime, &ins, &ipc);
       scaf_section_start_time = rtime;
+      scaf_serial_runtime += scaf_section_start_time - scaf_section_end_time;
       if(ret != PAPI_OK) printf("WARNING: Bad PAPI things happening. (%d)\n", ret);
    }
 #else
@@ -241,7 +246,10 @@
       int ret = PAPI_ipc(&rtime, &ptime, &ins, &ipc);
       if(ret != PAPI_OK) printf("WARNING: Bad PAPI things happening. (%d)\n", ret);
       scaf_section_ipc = ipc;
-      scaf_section_duration = (rtime - scaf_section_start_time);
+      scaf_section_end_time = rtime;
+      scaf_section_duration = (scaf_section_end_time - scaf_section_start_time);
+      scaf_parallel_runtime += scaf_section_duration;
+      //printf("Process ptime: %f, stime: %f --> %f%% parallel\n", scaf_parallel_runtime, scaf_serial_runtime, scaf_parallel_runtime / (scaf_parallel_runtime + scaf_serial_runtime) * 100.0);
    }
 #else
    {
@@ -290,6 +298,7 @@
       long long int ins;
       int ret = PAPI_ipc(&rtime, &ptime, &ins, &ipc);
       scaf_section_start_time = rtime;
+      scaf_serial_runtime += scaf_section_start_time - scaf_section_end_time;
       if(ret != PAPI_OK) printf("WARNING: Bad PAPI things happening. (%d)\n", ret);
    }
 #else
@@ -336,7 +345,9 @@
       int ret = PAPI_ipc(&rtime, &ptime, &ins, &ipc);
       if(ret != PAPI_OK) printf("WARNING: Bad PAPI things happening. (%d)\n", ret);
       scaf_section_ipc = ipc;
-      scaf_section_duration = (rtime - scaf_section_start_time);
+      scaf_section_end_time = rtime;
+      scaf_section_duration = (scaf_section_end_time - scaf_section_start_time);
+      scaf_parallel_runtime += scaf_section_duration;
    }
 #else
    {
@@ -446,7 +457,7 @@
    current_section->training_ipc_eff = scaf_section_ipc / response;
    current_section->training_ipc_speedup = ((float)current_threads) * current_section->training_ipc_eff;
    current_section->training_complete = 1;
-   printf(BLUE "Section (%p): @(1,%d){%f}{sIPC: %f; pIPC: %f} -> {EFF: %f; SPU: %f}" RESET "\n", current_section->section_id, scaf_section_duration, current_section->training_threads, current_section->training_serial_ipc, current_section->training_parallel_ipc, current_section->training_ipc_eff, current_section->training_ipc_speedup);
+   printf(BLUE "Section (%p): @(1,%d){%f}{sIPC: %f; pIPC: %f} -> {EFF: %f; SPU: %f}" RESET "\n", current_section->section_id, current_section->training_threads, scaf_section_duration, current_section->training_serial_ipc, current_section->training_parallel_ipc, current_section->training_ipc_eff, current_section->training_ipc_speedup);
 }

 void* scaf_gomp_training_control(void *unused){


Wrong line number. Try again.

Wrong line number. Try again.

--- src/lily_vm.c
+++ src/lily_vm.c
@@ -1381,7 +1381,7 @@
         char *name = func_val->trace_name;
         if (func_val->code) {
             path = func_val->import->path;
-            sprintf(line, "%d:", func_val->line_num);
+            sprintf(line, "%d:", frame_iter->line_num);
         }
         else
             path = "[C]";


update ziplist.c

update ziplist.c

--- src/ziplist.c
+++ src/ziplist.c
@@ -141,8 +141,11 @@
 #define ZIP_IS_STR(enc) (((enc) & ZIP_STR_MASK) < ZIP_STR_MASK)

 /* Utility macros */
+ //操作ziplist结构体
 #define ZIPLIST_BYTES(zl)       (*((uint32_t*)(zl)))
+//将ziplist跳过4字节
 #define ZIPLIST_TAIL_OFFSET(zl) (*((uint32_t*)((zl)+sizeof(uint32_t))))
+//将ziplist跳过8字节
 #define ZIPLIST_LENGTH(zl)      (*((uint16_t*)((zl)+sizeof(uint32_t)*2)))
 #define ZIPLIST_HEADER_SIZE     (sizeof(uint32_t)*2+sizeof(uint16_t))
 #define ZIPLIST_END_SIZE        (sizeof(uint8_t))
@@ -157,7 +160,7 @@
         ZIPLIST_LENGTH(zl) = intrev16ifbe(intrev16ifbe(ZIPLIST_LENGTH(zl))+incr); \
 }

-//压缩链表结构体
+//ziplist表的节点结构体
 typedef struct zlentry {
 		//prevrawlensize为存储上一个链表节点的长度数值所需要的字节数
 		//prevrawlen为上一个链表节点占用的长度
@@ -173,6 +176,7 @@
     unsigned char *p;
 } zlentry;

+//将ziplist的节点置0
 #define ZIPLIST_ENTRY_ZERO(zle) { \
     (zle)->prevrawlensize = (zle)->prevrawlen = 0; \
     (zle)->lensize = (zle)->len = (zle)->headersize = 0; \
@@ -250,7 +254,7 @@
  * entries length. */
 //从ptr指向的字符串中取出链表节点的编码、保存节点长度所需要的字节数、节点长度，并分别保存在encoding、lensize、len3个变量中
 #define ZIP_DECODE_LENGTH(ptr, encoding, lensize, len) do {                    \
-    ZIP_ENTRY_ENCODING((ptr), (encoding));                                     \
+		ZIP_ENTRY_ENCODING((ptr), (encoding));                                     \
     if ((encoding) < ZIP_STR_MASK) {                                           \
         if ((encoding) == ZIP_STR_06B) {                                       \
             (lensize) = 1;                                                     \
@@ -275,14 +279,18 @@

 /* Encode the length of the previous entry and write it to "p". Return the
  * number of bytes needed to encode this length if "p" is NULL. */
+//将链表中上一个节点的长度值编码放入p指针指向的缓冲区中，返回编码后所占有的字节数
 static unsigned int zipPrevEncodeLength(unsigned char *p, unsigned int len) {
     if (p == NULL) {
         return (len < ZIP_BIGLEN) ? 1 : sizeof(len)+1;
     } else {
         if (len < ZIP_BIGLEN) {
+						//如果上一个节点的长度值小于254，只需要用一个字节表示即可
             p[0] = len;
             return 1;
         } else {
+						//当长度值大于或等于254时使用5个字节存储，第1个字节的数值为254
+						//表示上一个节点的长度值大于等于254,接下来的4个字节才是真正的长度
             p[0] = ZIP_BIGLEN;
             memcpy(p+1,&len,sizeof(len));
             memrev32ifbe(p+1);
@@ -439,10 +447,18 @@
 }

 /* Create a new empty ziplist. */
+//创建新的ziplist
 unsigned char *ziplistNew(void) {
+		//初始大小( 8字节+2字节+1字节 )
+		//zlbytes：4字节，记录整个压缩列表占用内存的字节数
+		//zltail：4字节，记录压缩列表尾部节点距离起始地址的偏移量
+		//zllen：2字节，记录压缩列表包含的节点数量
+		//zlend：1字节，特殊值0xFF，标记压缩列表的结束
     unsigned int bytes = ZIPLIST_HEADER_SIZE+1;
     unsigned char *zl = zmalloc(bytes);
+		//记录zlbytes的大小为13字节( 没有节点 )
     ZIPLIST_BYTES(zl) = intrev32ifbe(bytes);
+		//将ziplist表移动到zltail字段起始位并赋值
     ZIPLIST_TAIL_OFFSET(zl) = intrev32ifbe(ZIPLIST_HEADER_SIZE);
     ZIPLIST_LENGTH(zl) = 0;
     zl[bytes-1] = ZIP_END;


Fix a forget zmalloc_oom() -> zmalloc_oom_handler() replacement.

--- src/zmalloc.c
+++ src/zmalloc.c
@@ -166,7 +166,7 @@
     realptr = (char*)ptr-PREFIX_SIZE;
     oldsize = *((size_t*)realptr);
     newptr = realloc(realptr,size+PREFIX_SIZE);
-    if (!newptr) zmalloc_oom(size);
+    if (!newptr) zmalloc_oom_handler(size);

     *((size_t*)newptr) = size;
     update_zmalloc_stat_free(oldsize);


Build fixes for example

Build fixes for example

--- src/examples/matlab_csv_serial/matlab_csv_serial.c
+++ src/examples/matlab_csv_serial/matlab_csv_serial.c
@@ -1,6 +1,6 @@
 /****************************************************************************
  *
- *   Copyright (C) 2014 PX4 Development Team. All rights reserved.
+ *   Copyright (c) 2014 PX4 Development Team. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -60,6 +60,7 @@
 #include <drivers/drv_gyro.h>
 #include <systemlib/perf_counter.h>
 #include <systemlib/systemlib.h>
+#include <systemlib/err.h>
 #include <poll.h>

 __EXPORT int matlab_csv_serial_main(int argc, char *argv[]);
@@ -153,7 +154,6 @@
 	/* Try to set baud rate */
 	struct termios uart_config;
 	int termios_state;
-	bool is_usb = false;

 	/* Back up the original uart configuration to restore it after exit */
 	if ((termios_state = tcgetattr(serial_fd, &uart_config)) < 0) {
@@ -225,7 +225,7 @@
 			if (fds[0].revents & POLLIN)
 			{
 				orb_copy(ORB_ID(sensor_accel0), accel0_sub, &accel0);
-				orb_copy(ORB_ID(sensor_accel1), accel0_sub, &accel1);
+				orb_copy(ORB_ID(sensor_accel1), accel1_sub, &accel1);
 				orb_copy(ORB_ID(sensor_gyro0), gyro0_sub, &gyro0);
 				orb_copy(ORB_ID(sensor_gyro1), gyro1_sub, &gyro1);


Matrix 4x4 multiplication using SSE instructions

git-svn-id: 5304e143e8d793994ae88e90452df1e2524f1faf@1374 a13746d7-5020-4d46-8679-245a07f888a7

error: pathspec 'sse-matmult.c' did not match any file(s) known to git

--- sse-matmult.c
+++ sse-matmult.c
@@ -0,0 +1,105 @@
+/*
+	Matrix 4x4 multiplication using SSE instructions, $Revision: 1.1 $
+
+	[Aa0 Aa1 Aa2 Aa3]  [Ba0 Ba1 Ba2 Ba3]   [Aa0*Ba0 + Aa1*Bb0 + Aa2*Bc0 + Aa3*Bd0, ..., ..., ...]
+	[Ab0 Ab1 Ab2 Ab3]  [Bb0 Bb1 Bb2 Bb3] = [Ab0*Ba0 + Ab1*Bb0 + Ab2*Bc0 + Ab3*Bd0, ..., ..., ...]
+	[Ac0 Ac1 Ac2 Ac3]  [Bc0 Bc1 Bc2 Bc3]   [..., ..., ..., ...]
+	[Ad0 Ad1 Ad2 Ad3]  [Bd0 Bd1 Bd2 Bd3]   [..., ..., ..., ...]
+
+	Author: Wojciech Mua
+	e-mail: wojciech_mula@poczta.onet.pl
+	www:    http://www.mula.w.pl
+
+	License: public domain
+
+	initial release 15.09.2007, last update $Date: 2007-09-15 21:45:37 $
+*/
+
+#include <math.h>
+#include "sse-aux.inc"
+
+void sse_matmat_mult(float mat1[4*4], float mat2[4*4], float mat3[4*4]) {
+asm(
+    // load all rows from M2, i.e. Ba, Bb, Bc an Bd
+    "movups 0x00(%1), %%xmm4	            \n" // xmm4 := Ba
+    "movups 0x10(%1), %%xmm5                \n" // xmm5 := Bb
+    "movups 0x20(%1), %%xmm6                \n" // xmm6 := Bc
+    "movups 0x30(%1), %%xmm7                \n" // xmm7 := Bd
+
+#define BLOCK(offset) \
+    /* load n-th row from matrix M1, for example Aa, and clone it */ \
+    "movups "#offset"(%0), %%xmm0           \n" /* xmm0 := Aa */ \
+    "movaps %%xmm0, %%xmm1                  \n" \
+    "movaps %%xmm0, %%xmm2                  \n" \
+    "movaps %%xmm0, %%xmm3                  \n" \
+    /* populate each element */ \
+    "shufps $0b00000000, %%xmm0, %%xmm0     \n" /* xmm0 := [Aa0, Aa0, Aa0, Aa0] */ \
+    "shufps $0b01010101, %%xmm1, %%xmm1     \n" /* xmm1 := [Aa1, Aa1, Aa1, Aa1] */ \
+    "shufps $0b10101010, %%xmm2, %%xmm2     \n" /* xmm2 := [Aa2, Aa2, Aa2, Aa2] */ \
+    "shufps $0b11111111, %%xmm3, %%xmm3     \n" /* xmm3 := [Aa3, Aa3, Aa3, Aa3] */ \
+    /* and mul by all M2 rows */ \
+    "mulps %%xmm4, %%xmm0                   \n" /* xmm0 := [Aa0*Ba0, Aa0*Ba1, Aa0*Ba2, Aa0*Ba3] */ \
+    "mulps %%xmm5, %%xmm1                   \n" \
+    "mulps %%xmm6, %%xmm2                   \n" \
+    "mulps %%xmm7, %%xmm3                   \n" \
+    /* finally calculate n-th row of resultant matrix */ \
+    "addps %%xmm1, %%xmm0                   \n" \
+    "addps %%xmm3, %%xmm2                   \n" \
+    "addps %%xmm2, %%xmm0                   \n" \
+    "movups %%xmm0, "#offset"(%2)           \n"
+
+    BLOCK(0x00)
+    BLOCK(0x10)
+    BLOCK(0x20)
+    BLOCK(0x30)
+    :
+    : "r" (mat1), "r" (mat2), "r" (mat3)
+);
+}
+
+
+void matmat_mult(float mat1[4*4], float mat2[4*4], float mat3[4*4]) {
+	int i, j, k;
+	for (j=0; j<4; j++) {
+		for (i=0; i<4; i++) {
+			mat3[i+4*j] = 0.0;
+			for (k=0; k<4; k++) {
+				mat3[i+4*j] += mat1[k+4*j] * mat2[i+4*k];
+			}
+		}
+	}
+}
+
+int main(int argc, char* argv[]) {
+	float mat1[4*4], mat2[4*4], res1[4*4], res2[4*4], err[4*4];
+	float range = 0.0;
+	int i;
+
+	initfrand();
+	if (argc > 1)
+		range = fabs(atof(argv[1]));
+	if (range == 0.0)
+		range = 1000.0;
+
+	for (i=0; i<16; i++) {
+		mat1[i] = frand(-range, range);
+		mat2[i] = frand(-range, range);
+	}
+
+	sse_matmat_mult(mat1, mat2, res2);
+	matmat_mult(mat1, mat2, res1);
+
+	printf("ref = \n");
+	for (i=0; i<4; i++) print_vect(&res1[4*i]);
+
+	printf("SSE = \n");
+	for (i=0; i<4; i++) print_vect(&res2[4*i]);
+
+	printf("err [%%] = \n");
+	for (i=0; i<16; i++) err[i] = 100.0 * (1.0 - res1[i]/res2[i]);
+	for (i=0; i<4; i++) print_vect(&err[4*i]);
+
+	return 0;
+}
+
+// vim: ts=8 nowrap


lib-index: Fixed failing transaction log test.

--- src/lib-index/test-mail-transaction-log-append.c
+++ src/lib-index/test-mail-transaction-log-append.c
@@ -44,6 +44,7 @@
 	struct mail_transaction_log_append_ctx *ctx;
 	const struct mail_transaction_header *hdr;
 	const unsigned int *bufp;
+	const struct mail_transaction_boundary *bound;

 	test_assert(mail_transaction_log_append_begin(log->index, MAIL_TRANSACTION_EXTERNAL, &ctx) == 0);
 	mail_transaction_log_append_add(ctx, MAIL_TRANSACTION_APPEND,
@@ -58,6 +59,13 @@
 	test_assert(file->sync_offset == file->buffer_offset + file->buffer->used);

 	hdr = file->buffer->data;
+	test_assert(hdr->type == (MAIL_TRANSACTION_BOUNDARY |
+				  MAIL_TRANSACTION_EXTERNAL));
+	test_assert(mail_index_offset_to_uint32(hdr->size) == sizeof(*hdr) + sizeof(*bound));
+	bound = (const void *)(hdr + 1);
+	test_assert(bound->size == file->buffer->used);
+	hdr = (const void *)(bound + 1);
+
 	test_assert(hdr->type == (MAIL_TRANSACTION_APPEND |
 				  MAIL_TRANSACTION_EXTERNAL));
 	test_assert(mail_index_offset_to_uint32(hdr->size) == sizeof(*hdr) + sizeof(buf[0]));


dbox: Fail if trying to create a mailbox that already exists.

--- src/lib-storage/index/dbox-common/dbox-storage.c
+++ src/lib-storage/index/dbox-common/dbox-storage.c
@@ -254,6 +254,12 @@
 	if (mailbox_open(box) < 0)
 		return -1;

+	if (mail_index_get_header(box->view)->uid_validity != 0) {
+		mail_storage_set_error(box->storage, MAIL_ERROR_EXISTS,
+				       "Mailbox already exists");
+		return -1;
+	}
+
 	/* if alt path already exists and contains files, rebuild storage so
 	   that we don't start overwriting files. */
 	alt_path = mailbox_list_get_path(box->list, box->name,


mdbox: If mdbox header is corrupted, resize it to make sure its size is correct.

--- src/lib-storage/index/dbox-multi/mdbox-storage.c
+++ src/lib-storage/index/dbox-multi/mdbox-storage.c
@@ -229,7 +229,7 @@

 	if (mdbox_read_header(mbox, &hdr, &need_resize) < 0) {
 		memset(&hdr, 0, sizeof(hdr));
-		need_resize = FALSE;
+		need_resize = TRUE;
 	}

 	new_hdr = hdr;


mailbox_list_index=yes: Make sure storage error doesn't change when updating STATUS info.

--- src/lib-storage/list/mailbox-list-index-status.c
+++ src/lib-storage/list/mailbox-list-index-status.c
@@ -515,7 +515,11 @@
 		return -1;
 	ctx = NULL;

+	/* it probably doesn't matter much here if we push/pop the error,
+	   but might as well do it. */
+	mail_storage_last_error_push(mailbox_get_storage(box));
 	(void)index_list_update_mailbox(box);
+	mail_storage_last_error_pop(mailbox_get_storage(box));
 	return 0;
 }

@@ -530,7 +534,12 @@
 		return -1;
 	t = NULL;

+	/* this transaction commit may have been done in error handling path
+	   and the caller still wants to access the current error. make sure
+	   that whatever we do here won't change the error. */
+	mail_storage_last_error_push(mailbox_get_storage(box));
 	(void)index_list_update_mailbox(box);
+	mail_storage_last_error_pop(mailbox_get_storage(box));
 	return 0;
 }


Allow PUBSUB NUMSUB without channels.

Allow PUBSUB NUMSUB without channels.

The result is an empty list but it is handy to call it programmatically.

--- src/pubsub.c
+++ src/pubsub.c
@@ -336,8 +336,8 @@
         }
         dictReleaseIterator(di);
         setDeferredMultiBulkLength(c,replylen,mblen);
-    } else if (!strcasecmp(c->argv[1]->ptr,"numsub") && c->argc > 2) {
-        /* PUBSUB NUMSUB Channel_1 [... Channel_N] */
+    } else if (!strcasecmp(c->argv[1]->ptr,"numsub") && c->argc >= 2) {
+        /* PUBSUB NUMSUB [Channel_1 ... Channel_N] */
         int j;

         addReplyMultiBulkLen(c,(c->argc-2)*2);


removed some dead code: - passwdfunction/data related code - ssl_ctx related code

--- src/pycurl.c
+++ src/pycurl.c
@@ -117,8 +117,6 @@
     PyObject *readdata_fp;
     PyObject *writedata_fp;
     PyObject *writeheader_fp;
-    PyObject *progressdata_fp;
-    PyObject *passwddata_fp;
     /* misc */
     void *options[OPTIONS_SIZE];
     char error[CURL_ERROR_SIZE+1];
@@ -288,8 +286,6 @@
     self->readdata_fp = NULL;
     self->writedata_fp = NULL;
     self->writeheader_fp = NULL;
-    self->progressdata_fp = NULL;
-    self->passwddata_fp = NULL;

     /* Zero string pointer memory buffer used by setopt */
     memset(self->options, 0, sizeof(self->options));
@@ -391,7 +387,7 @@
         goto cannot_copy;
     if (self->w_cb || self->r_cb || self->pro_cb || self->pwd_cb || self->d_cb || self->ssl_ctx_cb)
         goto cannot_copy;
-    if (self->readdata_fp || self->writedata_fp || self->writeheader_fp || self->progressdata_fp || self->passwddata_fp)
+    if (self->readdata_fp || self->writedata_fp || self->writeheader_fp)
         goto cannot_copy;
     for (i = 0; i < OPTIONS_SIZE; i++) {
         if (self->options[i] != NULL) {
@@ -469,8 +465,6 @@
         ZAP(self->readdata_fp);
         ZAP(self->writedata_fp);
         ZAP(self->writeheader_fp);
-        ZAP(self->progressdata_fp);
-        ZAP(self->passwddata_fp);
     }
 }

@@ -621,8 +615,6 @@
     VISIT(self->readdata_fp);
     VISIT(self->writedata_fp);
     VISIT(self->writeheader_fp);
-    VISIT(self->progressdata_fp);
-    VISIT(self->passwddata_fp);

     return 0;
 #undef VISIT
@@ -821,53 +813,6 @@
     }
     else {
         ret = (int)PyInt_AsLong(result);
-    }
-    Py_XDECREF(result);
-    PyEval_ReleaseThread(tmp_state);
-    return ret;
-}
-
-
-static int
-password_callback(void *client, const char *prompt, char* buffer, int buflen)
-{
-    PyObject *arglist;
-    PyObject *result;
-    CurlObject *self;
-    PyThreadState *tmp_state;
-    int ret = 1;       /* assume error */
-
-    self = (CurlObject *)client;
-    tmp_state = get_thread_state(self);
-    if (tmp_state == NULL || self->pwd_cb == NULL) {
-        return ret;
-    }
-    arglist = Py_BuildValue("(si)", prompt, buflen);
-    if (arglist == NULL)
-        return ret;
-
-    PyEval_AcquireThread(tmp_state);
-    result = PyEval_CallObject(self->pwd_cb, arglist);
-    Py_DECREF(arglist);
-    if (result == NULL) {
-        PyErr_Print();
-    }
-    else {
-        if (!PyString_Check(result)) {
-            PyErr_SetString(ErrorObject, "callback for PASSWDFUNCTION must return string");
-            PyErr_Print();
-        }
-        else {
-            char *buf = PyString_AsString(result);
-            if ((int)strlen(buf) > buflen) {
-                PyErr_SetString(ErrorObject, "string from PASSWDFUNCTION callback is too long");
-                PyErr_Print();
-            }
-            else {
-                strcpy(buffer, buf);
-                ret = 0;        /* success */
-            }
-        }
     }
     Py_XDECREF(result);
     PyEval_ReleaseThread(tmp_state);
@@ -1141,11 +1086,6 @@

         /* Ensure the option specified a file as well as the input */
         switch (option) {
-#if 0
-        /* REMOVED */
-        case CURLOPT_PASSWDDATA:
-        case CURLOPT_PROGRESSDATA:
-#endif
         case CURLOPT_READDATA:
         case CURLOPT_WRITEDATA:
             break;
@@ -1172,17 +1112,6 @@
         Py_INCREF(obj);

         switch (option) {
-#if 0
-        /* REMOVED */
-        case CURLOPT_PASSWDDATA:
-            ZAP(self->passwddata_fp);
-            self->passwddata_fp = obj;
-            break;
-        case CURLOPT_PROGRESSDATA:
-            ZAP(self->progressdata_fp);
-            self->progressdata_fp = obj;
-            break;
-#endif
         case CURLOPT_READDATA:
             ZAP(self->readdata_fp);
             self->readdata_fp = obj;
@@ -1326,7 +1255,6 @@
         const curl_read_callback r_cb = read_callback;
         const curl_write_callback h_cb = header_callback;
         const curl_progress_callback pro_cb = progress_callback;
-        const curl_passwd_callback pwd_cb = password_callback;
         const curl_debug_callback d_cb = debug_callback;
 #if (LIBCURL_VERSION_NUM >= 0x070a06)
 #if 0
@@ -1364,19 +1292,10 @@
             break;
         case CURLOPT_PROGRESSFUNCTION:
             Py_INCREF(obj);
-            ZAP(self->progressdata_fp);
             ZAP(self->pro_cb);
             self->pro_cb = obj;
             curl_easy_setopt(self->handle, CURLOPT_PROGRESSFUNCTION, pro_cb);
             curl_easy_setopt(self->handle, CURLOPT_PROGRESSDATA, self);
-            break;
-        case CURLOPT_PASSWDFUNCTION:
-            Py_INCREF(obj);
-            ZAP(self->passwddata_fp);
-            ZAP(self->pwd_cb);
-            self->pwd_cb = obj;
-            curl_easy_setopt(self->handle, CURLOPT_PASSWDFUNCTION, pwd_cb);
-            curl_easy_setopt(self->handle, CURLOPT_PASSWDDATA, self);
             break;
         case CURLOPT_DEBUGFUNCTION:
             Py_INCREF(obj);
@@ -1385,18 +1304,6 @@
             curl_easy_setopt(self->handle, CURLOPT_DEBUGFUNCTION, d_cb);
             curl_easy_setopt(self->handle, CURLOPT_DEBUGDATA, self);
             break;
-#if (LIBCURL_VERSION_NUM >= 0x070a06)
-#if 0
-        /* FIXME - implement this */
-        case CURLOPT_SSL_CTX_FUNCTION:
-            Py_INCREF(obj);
-            ZAP(self->ssl_ctx_cb);
-            self->ssl_ctx_cb = obj;
-            curl_easy_setopt(self->handle, CURLOPT_SSL_CTX_FUNCTION, ssl_ctx_cb);
-            curl_easy_setopt(self->handle, CURLOPT_SSL_CTX_DATA, self);
-            break;
-#endif
-#endif
         default:
             /* None of the function options were recognized, throw exception */
             PyErr_SetString(PyExc_TypeError, "functions are not supported for this option");
@@ -2509,18 +2416,9 @@
     insint_c(d, "INTERFACE", CURLOPT_INTERFACE);
     insint_c(d, "KRB4LEVEL", CURLOPT_KRB4LEVEL);
     insint_c(d, "PROGRESSFUNCTION", CURLOPT_PROGRESSFUNCTION);
-#if 0
-     /* REMOVED */
-    insint_c(d, "PROGRESSDATA", CURLOPT_PROGRESSDATA);
-#endif
     insint_c(d, "SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER);
     insint_c(d, "CAPATH", CURLOPT_CAPATH);
     insint_c(d, "CAINFO", CURLOPT_CAINFO);
-    insint_c(d, "PASSWDFUNCTION", CURLOPT_PASSWDFUNCTION);
-#if 0
-     /* REMOVED */
-    insint_c(d, "PASSWDDATA", CURLOPT_PASSWDDATA);
-#endif
     insint_c(d, "OPT_FILETIME", CURLOPT_FILETIME);
     insint_c(d, "MAXREDIRS", CURLOPT_MAXREDIRS);
     insint_c(d, "MAXCONNECTS", CURLOPT_MAXCONNECTS);


Remove support for older versions in some more places.

--- src/pycurl.c
+++ src/pycurl.c
@@ -1,4 +1,4 @@
-/* $Id: pycurl.c,v 1.57 2004/06/24 08:39:29 kjetilja Exp $ */
+/* $Id: pycurl.c,v 1.58 2004/06/24 17:39:40 mfx Exp $ */

 /* PycURL -- cURL Python module
  *
@@ -665,11 +665,7 @@
     PyObject *arglist;
     PyObject *result = NULL;

-#if (LIBCURL_VERSION_NUM > 0x070c00)
     size_t ret = CURL_READFUNC_ABORT;     /* assume error, this actually works */
-#else
-    size_t ret = 0;     /* assume error, this cause things to hang */
-#endif
     int total_size;

     /* acquire thread */
@@ -1042,12 +1038,7 @@
         return Py_None;
     }

-/* Up to libcurl 7.12.1 CURLOPT_FILETIME was incorrectly assigned a OBJECTPOINT */
-#if (LIBCURL_VERSION_NUM < 0x070c01)
-#define IS_LONG_OPTION(o)   (o < CURLOPTTYPE_OBJECTPOINT || o == CURLOPT_FILETIME)
-#else
 #define IS_LONG_OPTION(o)   (o < CURLOPTTYPE_OBJECTPOINT)
-#endif
 #define IS_OFF_T_OPTION(o)  (o >= CURLOPTTYPE_OFF_T)

     /* Handle the case of integer arguments */


- added more sanity checks and fixed the exception messages

--- src/pycurl.c
+++ src/pycurl.c
@@ -1355,6 +1355,13 @@
                     int j, k, l;
                     struct curl_forms *forms = NULL;

+                    /* Sanity check that there are at least two tuple items */
+                    if (tlen < 2) {
+                        curl_formfree(post);
+                        PyErr_SetString(PyExc_TypeError, "tuple must contain at least one option and one value");
+                        return NULL;
+                    }
+
                     /* Allocate enough space to accommodate length options for content */
                     forms = PyMem_Malloc(sizeof(struct curl_forms) * ((tlen*2) + 1));
                     if (forms == NULL) {
@@ -1369,19 +1376,19 @@
                         int olen, val;

                         if (j == (tlen-1)) {
-                            PyErr_SetString(PyExc_TypeError, "expected one more tuple value");
+                            PyErr_SetString(PyExc_TypeError, "expected value");
                             PyMem_Free(forms);
                             curl_formfree(post);
                             return NULL;
                         }
                         if (!PyInt_Check(PyTuple_GET_ITEM(t, j))) {
-                            PyErr_SetString(PyExc_TypeError, "expected long value in tuple");
+                            PyErr_SetString(PyExc_TypeError, "option must be long");
                             PyMem_Free(forms);
                             curl_formfree(post);
                             return NULL;
                         }
                         if (!PyString_Check(PyTuple_GET_ITEM(t, j+1))) {
-                            PyErr_SetString(PyExc_TypeError, "expected string value in tuple");
+                            PyErr_SetString(PyExc_TypeError, "value must be string");
                             PyMem_Free(forms);
                             curl_formfree(post);
                             return NULL;


Few more debug messages.

Few more debug messages.

--- src/core/windows.c
+++ src/core/windows.c
@@ -64,6 +64,7 @@
 #include <direct/trace.h>
 #include <direct/util.h>

+#include <gfx/convert.h>
 #include <gfx/util.h>

 #include <core/layers_internal.h>
@@ -249,6 +250,8 @@
      DFBSurfaceCapabilities  surface_caps;
      DFBSurfacePixelFormat   pixelformat;

+     D_DEBUG_AT( Core_Windows, "%s( %p )\n", __FUNCTION__, stack );
+
      D_ASSERT( stack != NULL );
      D_ASSERT( stack->context != NULL );
      D_ASSERT( desc != NULL );
@@ -413,6 +416,15 @@
                /* Link the primary region into the window structure. */
                dfb_layer_region_link( &window->primary_region, region );
                dfb_layer_region_unref( region );
+
+               D_DEBUG_AT( Core_Windows, "  -> %dx%d %s %s\n",
+                           window->config.bounds.w, window->config.bounds.h,
+                           dfb_pixelformat_name(pixelformat),
+                           (surface_policy == CSP_VIDEOONLY) ?
+                              "VIDEOONLY" :
+                              ((surface_policy == CSP_SYSTEMONLY) ?
+                                   "SYSTEM ONLY" :
+                                   "AUTO VIDEO") );

                /* Give the WM a chance to provide its own surface. */
                if (!window->surface) {
@@ -435,6 +447,11 @@
                }
           }
      }
+     else
+          D_DEBUG_AT( Core_Windows, "  -> %dx%d - INPUT ONLY!\n",
+                      window->config.bounds.w, window->config.bounds.h );
+
+     D_DEBUG_AT( Core_Windows, "  -> %p\n", window );

      /* Pass the new window to the window manager. */
      ret = dfb_wm_add_window( stack, window );


- forgot one Py_ssize_t def

- forgot one Py_ssize_t def

--- src/pycurl.c
+++ src/pycurl.c
@@ -1,4 +1,4 @@
-/* $Id: pycurl.c,v 1.130 2007/04/22 18:12:04 kjetilja Exp $ */
+/* $Id: pycurl.c,v 1.131 2007/04/23 10:29:36 kjetilja Exp $ */

 /* PycURL -- cURL Python module
  *
@@ -1164,7 +1164,7 @@
     /* handle result */
     if (PyString_Check(result)) {
         char *buf = NULL;
-        int obj_size = -1;
+        Py_ssize_t obj_size = -1;
         Py_ssize_t r;
         r = PyString_AsStringAndSize(result, &buf, &obj_size);
         if (r != 0 || obj_size < 0 || obj_size > total_size) {


Fixed author.

Fixed author.

--- src/appleseed/foundation/utility/privateaccess.h
+++ src/appleseed/foundation/utility/privateaccess.h
@@ -5,7 +5,7 @@
 //
 // This software is released under the MIT license.
 //
-// Copyright (c) 2010-2012 Francois Beaune, Jupiter Jazz Limited
+// Copyright (c) 2010-2012 Esteban Tovagliari, Jupiter Jazz Limited
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal


70.00 points

70.00 points

--- HexagonalGrid/main.c
+++ HexagonalGrid/main.c
@@ -3,22 +3,46 @@
 #include <math.h>
 #include <stdlib.h>

+#define DEBUG       1
+
 int main() {
+#if DEBUG
+    FILE * fp;
+    fp = fopen("input.txt", "r");
+
+    FILE * fp_out;
+    fp_out = fopen("output.txt", "w");
+#endif
+
     int t;

+#if DEBUG
+    fscanf(fp, "%d", &t);
+#else
     scanf("%d", &t);
+#endif

     char * * output = (char * *)malloc(t * sizeof(char *));

     for (size_t i = 0; i < t; i++) {
         int n;
+
+#if DEBUG
+        fscanf(fp, "%d", &n);
+#else
         scanf("%d", &n);
+#endif

         char * grid1 = malloc(n + 2);
         char * grid2 = malloc(n + 2);

+#if DEBUG
+        fscanf(fp, "%s", grid1 + 1);
+        fscanf(fp, "%s", grid2 + 1);
+#else
         scanf("%s", grid1 + 1);
         scanf("%s", grid2 + 1);
+#endif

         unsigned char * * cnt = (unsigned char * *)malloc((n + 1) * sizeof(unsigned char *));
         for (size_t j = 0; j < n + 1; j++) {
@@ -110,6 +134,14 @@
                     if ('0' == grid1[j - 1]) {
                         cnt[j][j] = cnt[j - 2][j - 1];
                     }
+
+                    if ('0' == grid2[j - 1]) {
+                        cnt[j][j] += cnt[j - 1][j - 2];
+                    }
+
+                    if (0 < cnt[j][j]) {
+                        cnt[j][j] = 1;
+                    }
                 }
             }
         }
@@ -133,8 +165,17 @@
     }

     for (size_t i = 0; i < t; i++) {
+#if DEBUG
+        fprintf(fp_out, "%s\n", output[i]);
+#else
         printf("%s\n", output[i]);
+#endif
     }
+
+#if DEBUG
+    fclose(fp);
+    fclose(fp_out);
+#endif

     return 0;
 }


We didn't update flags to maildir filenames when maildir was fully synced.

--- src/lib-storage/index/maildir/maildir-sync-index.c
+++ src/lib-storage/index/maildir/maildir-sync-index.c
@@ -392,6 +392,15 @@
 		/* the private flags are stored only in indexes, keep them */
 		ctx->flags |= rec->flags & mbox->ibox.box.private_flags_mask;

+		if (index_sync_changes_have(ctx->sync_changes)) {
+			/* apply flag changes to maildir */
+			if (maildir_file_do(mbox, ctx->uid,
+					    maildir_sync_flags, ctx) < 0)
+				ctx->flags |= MAIL_INDEX_MAIL_FLAG_DIRTY;
+			if ((++changes % MAILDIR_SLOW_MOVE_COUNT) == 0)
+				maildir_sync_notify(ctx->maildir_sync_ctx);
+		}
+
 		if ((uflags & MAILDIR_UIDLIST_REC_FLAG_NONSYNCED) != 0) {
 			/* partial syncing */
 			if ((uflags & MAILDIR_UIDLIST_REC_FLAG_NEW_DIR) != 0) {
@@ -403,15 +412,6 @@
 			continue;
 		}

-		if (index_sync_changes_have(ctx->sync_changes)) {
-			/* apply flag changes to maildir */
-			if (maildir_file_do(mbox, ctx->uid,
-					    maildir_sync_flags, ctx) < 0)
-				ctx->flags |= MAIL_INDEX_MAIL_FLAG_DIRTY;
-			if ((++changes % MAILDIR_SLOW_MOVE_COUNT) == 0)
-				maildir_sync_notify(ctx->maildir_sync_ctx);
-		}
-
 		if ((rec->flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0) {
 			/* we haven't been able to update maildir with this
 			   record's flag changes. don't sync them. */


fix debug message

fix debug message

Change-Id: Iee8f91ae2e50128446def7d3f35a541db379136b
Reviewed-on: http://review.couchbase.org/81328
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>

--- src/logging.c
+++ src/logging.c
@@ -202,7 +202,7 @@
     lcb_log(settings, subsys, severity, srcfile, srcline,
         "vBucket config parsing failed: %s. Raw text in DEBUG level", errstr);
     if (!origin_txt) {
-        errstr = "<FIXME: No origin text available>";
+        origin_txt = "<FIXME: No origin text available>";
     }
     lcb_log(settings, subsys, LCB_LOG_DEBUG, srcfile, srcline, "%s", origin_txt);
 }


* subversion/include/svn_string.h:
  (svn_string_from_stringbuf): explain a bit more about this function

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

--- subversion/include/svn_string.h
+++ subversion/include/svn_string.h
@@ -180,7 +180,8 @@
 svn_string_find_char_backward(const svn_string_t *str, char ch);

 /** Returns the @a svn_string_t information contained in the data and
- * len members of @a strbuf.
+ * len members of @a strbuf. This is effectively a typecast, converting
+ * @a strbuf into an svn_string_t.
  */
 const svn_string_t *
 svn_string_from_stringbuf(const svn_stringbuf_t *strbuf);


* subversion/libsvn_client/copy.c (repos_to_wc_copy_cb): Add comment.

Suggested by: julianfoad

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

--- subversion/libsvn_client/copy.c
+++ subversion/libsvn_client/copy.c
@@ -1667,6 +1667,7 @@
   svn_client_ctx_t *ctx;
 };

+/* Implements svn_wc__with_write_lock_func_t. */
 static svn_error_t *
 repos_to_wc_copy_cb(void *baton,
                     apr_pool_t *result_pool,


fix for compiler warning form the main tree

--- Hybrid/vtk3DWidget.h
+++ Hybrid/vtk3DWidget.h
@@ -128,7 +128,7 @@
   float InitialBounds[6];
   float InitialLength;
   float HandleSize;
-  float SizeHandles(float factor=1.0);
+  float SizeHandles(float factor);
   virtual void SizeHandles() {}//subclass in turn invokes parent's SizeHandles()

   //used to track the depth of the last pick; also interacts with handle sizing


When calling read_config, make sure we have the FORMAT member
of the ffd struct initialized.

* subversion/libsvn_fs_fs/fs_fs.c
  (pack_body): use FFD members instead of independent variables

Found by: philip

--- subversion/libsvn_fs_fs/fs_fs.c
+++ subversion/libsvn_fs_fs/fs_fs.c
@@ -9560,50 +9560,51 @@
 {
   struct pack_baton *pb = baton;
   fs_fs_data_t ffd;
-  int format, max_files_per_dir;
   apr_int64_t completed_shards;
   apr_int64_t i;
   svn_revnum_t youngest;
   apr_pool_t *iterpool;
   const char *rev_data_path;
   const char *revprops_data_path = NULL;
-  svn_revnum_t min_unpacked_rev;

   /* read repository settings */
-  SVN_ERR(read_format(&format, &max_files_per_dir, path_format(pb->fs, pool),
-                      pool));
-  SVN_ERR(check_format(format));
+  memset(&ffd, 0, sizeof(ffd));
+  SVN_ERR(read_format(&ffd.format, &ffd.max_files_per_dir,
+                      path_format(pb->fs, pool), pool));
+  SVN_ERR(check_format(ffd.format));
   SVN_ERR(read_config(&ffd, pb->fs->path, pool));

   /* If the repository isn't a new enough format, we don't support packing.
      Return a friendly error to that effect. */
-  if (format < SVN_FS_FS__MIN_PACKED_FORMAT)
+  if (ffd.format < SVN_FS_FS__MIN_PACKED_FORMAT)
     return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
       _("FSFS format (%d) too old to pack; please upgrade the filesystem."),
-      format);
+      ffd.format);

   /* If we aren't using sharding, we can't do any packing, so quit. */
-  if (!max_files_per_dir)
+  if (!ffd.max_files_per_dir)
     return SVN_NO_ERROR;

-  SVN_ERR(read_min_unpacked_rev(&min_unpacked_rev,
+  SVN_ERR(read_min_unpacked_rev(&ffd.min_unpacked_rev,
                                 path_min_unpacked_rev(pb->fs, pool),
                                 pool));

   SVN_ERR(get_youngest(&youngest, pb->fs->path, pool));
-  completed_shards = (youngest + 1) / max_files_per_dir;
+  completed_shards = (youngest + 1) / ffd.max_files_per_dir;

   /* See if we've already completed all possible shards thus far. */
-  if (min_unpacked_rev == (completed_shards * max_files_per_dir))
+  if (ffd.min_unpacked_rev == (completed_shards * ffd.max_files_per_dir))
     return SVN_NO_ERROR;

   rev_data_path = svn_dirent_join(pb->fs->path, PATH_REVS_DIR, pool);
-  if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
+  if (ffd.format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
     revprops_data_path = svn_dirent_join(pb->fs->path, PATH_REVPROPS_DIR,
                                          pool);

   iterpool = svn_pool_create(pool);
-  for (i = min_unpacked_rev / max_files_per_dir; i < completed_shards; i++)
+  for (i = ffd.min_unpacked_rev / ffd.max_files_per_dir;
+       i < completed_shards;
+       i++)
     {
       svn_pool_clear(iterpool);

@@ -9611,7 +9612,7 @@
         SVN_ERR(pb->cancel_func(pb->cancel_baton));

       SVN_ERR(pack_shard(rev_data_path, revprops_data_path,
-                         pb->fs->path, i, max_files_per_dir,
+                         pb->fs->path, i, ffd.max_files_per_dir,
                          ffd.revprop_pack_size,
                          ffd.compress_packed_revprops
                            ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT


swiotlb: replace dma_length with sg_dma_len() macro

This patch replace dma_length in "lib/swiotlb.c" to sg_dma_len() macro,
because the build error can occur if CONFIG_NEED_SG_DMA_LENGTH is not
set, and CONFIG_SWIOTLB is set.

Singed-off-by: EunBong Song <1a7e7e98e070490e67aa35ab67fbf9fdda8f48ac@samsung.com>
Signed-off-by: Stefano Stabellini <22a0c6385d750d07aa383c9f813cf6f0228657d8@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>


more checking of metadata and coord vars

--- nc_perf/tst_gfs_data_1.c
+++ nc_perf/tst_gfs_data_1.c
@@ -89,6 +89,7 @@
     int dimids_in[NDIM4];
     size_t len_in;
     double *grid_xt_in, *grid_yt_in;
+    double *lat_in, lon_in;
     float *phalf_in, *pfull_in;
     int d, v, i;


Accepts a file as the input

Accepts a file as the input

--- stackulator.c
+++ stackulator.c
@@ -9,6 +9,7 @@

 int main(int argc, char* argv[]) {
     int i;
+    FILE* in = stdin;
     char c = ' ', waiting, interactive_mode = TRUE;
     stack* s = stack_init();

@@ -25,13 +26,21 @@
             printf("options :\n");
             printf("    -s, --silent : don't show '>' prompt character\n");
             printf("    -v, --verbose : show useful stuff instead of just the '>' prompt character\n");
-            // printf("    -e, --ed : `ed` mode\n");
             printf("    -h, --help : displays help\n");
+            printf("    -t, --test : runs the tests\n");
             return EXIT_SUCCESS;
         } else if(strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0) {
-            test_all();
-            return EXIT_SUCCESS;
+            return test_all() ? EXIT_SUCCESS : EXIT_FAILURE;
         }
+    }
+
+    // Fichier en entrée
+    if(i < argc) {
+        in = fopen(argv[i], "r");
+        if(in == NULL) {
+            return EXIT_FAILURE;
+        }
+        interactive_mode = FALSE;
     }

     if(interactive_mode == 1) {
@@ -40,7 +49,7 @@
         printf("0:(null)> ");
     }

-    while((c = getchar()) != EOF) {
+    while((c = getc(in)) != EOF) {
         waiting = FALSE;

         if(c >= '0' && c <= '9') {
@@ -61,12 +70,12 @@
                 digit->value = 0;
                 prev_addr = digit;

-                while((c = getchar()) == '0');
+                while((c = getc(in)) == '0');

                 // Si ça commençait avec des 0 non-significatifs, on les flush
                 if(c >= '1' && c <= '9') {
                     digit->value = c - '0';
-                    c = getchar();
+                    c = getc(in);
                 }
             }

@@ -81,7 +90,7 @@

                 prev_addr = digit;

-                c = getchar();
+                c = getc(in);
             }

             num->first = prev_addr;
@@ -145,17 +154,16 @@
            if(!stack_empty(s)) {
                 bignum* a = stack_pop(s);
                 bignum_destoroyah(a);
-            }
+            }
         } else if(c == '#') {
             // Clear stack
             while(!stack_empty(s)) {
                 stack_pop(s);
             }
-            printf("Stack cleared\n");
         } else {
             fprintf(stderr, "Symbole inconnu ignoré : %c", c);
             while(c != ' ' && c != '\n') {
-                c = getchar();
+                c = getc(in);
                 fprintf(stderr, "%c", c);
             }
             fprintf(stderr, "\n");


Issue 1579, there is no point creating and destroying a shared lock
before running recover.

* subversion/libsvn_repos/repos.c
  (svn_repos_recover): Remove the shared lock code.

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

--- subversion/libsvn_repos/repos.c
+++ subversion/libsvn_repos/repos.c
@@ -1129,48 +1129,6 @@
   svn_repos_t *repos;
   apr_pool_t *subpool = svn_pool_create (pool);

-  /* Destroy ALL existing svn locks on the repository.  If we're
-     recovering, we need to ensure we have exclusive access.  The
-     theory is that the caller *knows* that all existing locks are
-     'dead' ones, left by dead processes.  (The caller might be a
-     human running 'svnadmin recover', or maybe some future repository
-     lock daemon.) */
-  {
-    const char *lockfile_path;
-    apr_file_t *lockfile_handle;
-    apr_status_t apr_err;
-    svn_repos_t *locked_repos;
-
-    /* We're not calling get_repos to fetch a repository structure,
-       because this routine actually tries to open the db environment,
-       which would hang.   So we replicate a bit of get_repos's code
-       here: */
-    SVN_ERR (check_repos_version (path, subpool));
-
-    locked_repos = apr_pcalloc (subpool, sizeof (*locked_repos));
-    init_repos_dirs (locked_repos, path, subpool);
-
-    /* Get a filehandle for the wedged repository's db lockfile. */
-    lockfile_path = svn_repos_db_lockfile (locked_repos, subpool);
-    SVN_ERR_W (svn_io_file_open (&lockfile_handle, lockfile_path,
-                                 APR_READ, APR_OS_DEFAULT, pool),
-               "svn_repos_recover: error opening db lockfile");
-
-    apr_err = apr_file_unlock (lockfile_handle);
-    if (apr_err && ! APR_STATUS_IS_EACCES(apr_err))
-      return svn_error_createf
-        (apr_err, NULL,
-         "svn_repos_recover: failed to delete all locks on repository '%s'.",
-         path);
-
-    apr_err = apr_file_close (lockfile_handle);
-    if (apr_err)
-      return svn_error_createf
-        (apr_err, NULL,
-         "svn_repos_recover: failed to close lockfile on repository '%s'.",
-         path);
-  }
-
   /* Fetch a repository object initialized with an EXCLUSIVE lock on
      the database.   This will at least prevent others from trying to
      read or write to it while we run recovery. */


Fix incorrect stack pointer usage in StgRun() on x86_64

The STG_RETURN code from StgCRun.c is incorrect for x86_64 variants
where the ABI doesn't impose a mandatory red zone for the stack, like on
Windows or Xen/HaLVM. The current implementation restores the stack
pointer first, which effectively marks the area with the saved registers
as reusable. Later, the CPU registers are restored from this "free"
area.

This ordering happens to work by accident on operating systems that
strictly adhere to the System V ABI, because any interrupt/signal
delivery is guaranteed to leave the first 128 bytes past the stack
pointer untouched (red zone). On other systems this might result in
corrupted CPU registers if an interruption happens just after restoring
the stack pointer.

The red zone is usually only used by small leaf functions to avoid
updates to the stack pointer and exploiting it doesn't give us any
advantage in this case.

Reviewers: austin, rwbarton

Reviewed By: rwbarton

Subscribers: thomie, simonmar

Differential Revision: https://phabricator.haskell.org/D1120

GHC Trac Issues: #10155

--- rts/StgCRun.c
+++ rts/StgCRun.c
@@ -302,19 +302,18 @@
          * restore callee-saves registers.  (Don't stomp on %%rax!)
          */
         "addq %0, %%rsp\n\t"
-        "movq %%rsp, %%rdx\n\t"
+        "movq 0(%%rsp),%%rbx\n\t"       /* restore the registers saved above */
+        "movq 8(%%rsp),%%rbp\n\t"
+        "movq 16(%%rsp),%%r12\n\t"
+        "movq 24(%%rsp),%%r13\n\t"
+        "movq 32(%%rsp),%%r14\n\t"
+        "movq 40(%%rsp),%%r15\n\t"
+#if defined(mingw32_HOST_OS)
+        "movq 48(%%rsp),%%rdi\n\t"
+        "movq 56(%%rsp),%%rsi\n\t"
+        "movq 64(%%rsp),%%xmm6\n\t"
+#endif
         "addq %1, %%rsp\n\t"
-        "movq 0(%%rdx),%%rbx\n\t"       /* restore the registers saved above */
-        "movq 8(%%rdx),%%rbp\n\t"
-        "movq 16(%%rdx),%%r12\n\t"
-        "movq 24(%%rdx),%%r13\n\t"
-        "movq 32(%%rdx),%%r14\n\t"
-        "movq 40(%%rdx),%%r15\n\t"
-#if defined(mingw32_HOST_OS)
-        "movq 48(%%rdx),%%rdi\n\t"
-        "movq 56(%%rdx),%%rsi\n\t"
-        "movq 64(%%rdx),%%xmm6\n\t"
-#endif
         "retq"

         :


* subversion/libsvn_subr/crypto.c
  (svn_crypto__generate_secret_checktext): Ensure that we are
    generating block-aligned random "stuff".

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


Don't invoke the authz_read func yet.  It (and only it, currently) can
cause 'absent' flags to appear in working copies, and we want to test
that flag a bit more before anyone has to deal with it in real life.

* subversion/mod_dav_svn/update.c
  (dav_svn__update_report): Pass nulls for authz_read func and baton
    to svn_repos_dir_delta calls, for now.

--- subversion/mod_dav_svn/update.c
+++ subversion/mod_dav_svn/update.c
@@ -1005,7 +1005,8 @@
                                      recurse,
                                      ignore_ancestry,
                                      editor, &uc,
-                                     authz_read, &arb,
+                                     NULL /* authz_read */,
+                                     NULL /* &arb */,
                                      resource->pool)))
     {
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -1147,8 +1148,8 @@
                                      uc.rev_root, dst_path,
                                      /* re-use the editor */
                                      editor, &uc,
-                                     authz_read,
-                                     &arb,
+                                     NULL /* authz_read */,
+                                     NULL /* &arb */,
                                      FALSE, /* no text deltas */
                                      recurse,
                                      TRUE, /* send entryprops */


Update wait_for_client

Update wait_for_client

--- chat/wait_for_client.c
+++ chat/wait_for_client.c
@@ -1,41 +1,35 @@
 #include "wait_for_client.h"

-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <errno.h>
+#include <string.h>

-int wait_for_client(int sfd){
-  fprintf(stderr,"FONCTION wait_for_client \n");
-  char buf[0];
-  fprintf(stderr,"FONCTION wait_for_client2 \n");
-  int nread;
-  fprintf(stderr,"FONCTION wait_for_client3 \n");
-  struct sockaddr_in6 peer_addr;
-  fprintf(stderr,"FONCTION wait_for_client4 \n");
-  socklen_t peer_addr_len;
-  fprintf(stderr,"FONCTION wait_for_client5 \n");
-
-  nread = recvfrom(sfd, buf, 0, MSG_PEEK, (struct sockaddr *) &peer_addr, &peer_addr_len);
-  if(nread >= 0)
-  {
-    fprintf(stderr,"FONCTION wait_for_client6 \n");
-
-    int co = connect(sfd, (const struct sockaddr *) &peer_addr, peer_addr_len);
-    if(co == 0)
-    {
-      fprintf(stderr,"FONCTION wait_for_client7 \n");
-      return 0;
-    }
-    fprintf(stderr,"connect() error \n");
-    return -1;
-  }
-  else
-  {
-    fprintf(stderr,"recvfrom() error \n");
-    return -1;
-  }
+#define BUF_SIZE 1024
+
+int wait_for_client(int sfd){
+        char buf[BUF_SIZE];
+        int nread;
+        struct sockaddr_in6 peer_addr;
+        socklen_t peer_addr_len = sizeof(struct sockaddr_in6);
+
+        fprintf(stderr, "Before recvfrom().\n");
+        nread = recvfrom(sfd, buf, BUF_SIZE, 0, (struct sockaddr *) &peer_addr, &peer_addr_len);
+        fprintf(stderr, "After recvfrom().\n");
+        if(nread >= 0) {
+                if(connect(sfd, (const struct sockaddr *) &peer_addr, peer_addr_len) == 0) {
+                        return(0);
+                }
+
+                fprintf(stderr,"connect() failed.\n");
+                return(-1);
+        } else {
+                fprintf(stderr,"recvfrom() failed and returned %d.\n", nread);
+                fprintf(stderr, "errno : %s.\n", strerror(errno));
+                return(-1);
+        }
 }


Added name of test to result.

Added name of test to result.

git-svn-id: ae38cf1093b87151f738d2b2220cac7742ad2e55@155 64e312b2-a51f-0410-8e61-82d0ca0eb02a

--- check/src/check_impl.h
+++ check/src/check_impl.h
@@ -70,6 +70,7 @@
   char *file;    /* File where the test occured */
   int line;      /* Line number where the test occurred */
   const char *tcname;  /* Test case that generated the result */
+  const char *tname;  /* Test that generated the result */
   char *msg;     /* Failure message */
 };


Save global reset counter first in rcfile

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- src/rcfile.c
+++ src/rcfile.c
@@ -38,12 +38,12 @@
 	if (!reason->label[0])
 		strlcpy(reason->label, "XBAD_LABEL", sizeof(reason->label));

+	fprintf(fp, WDT_REASON_CNT ": %d\n", reason->counter);
 	fprintf(fp, WDT_REASON_PID ": %d\n", pid);
 	fprintf(fp, WDT_REASON_WID ": %d\n", reason->wid);
 	fprintf(fp, WDT_REASON_LBL ": %s\n", reason->label);
 	fprintf(fp, WDT_REASON_CSE ": %d\n", reason->cause);
 	fprintf(fp, WDT_REASON_STR ": %s\n", wdog_reboot_reason_str(reason));
-	fprintf(fp, WDT_REASON_CNT ": %d\n", reason->counter);
 	fclose(fp);

 	return 0;
@@ -76,13 +76,13 @@
 	}

 	while (fgets(buf, sizeof(buf), fp)) {
+		if (sscanf(buf, WDT_REASON_CNT ": %d\n", &reason->counter) == 1)
+			continue;
 		if (sscanf(buf, WDT_REASON_WID ": %d\n", &reason->wid) == 1)
-			continue;
-		if (sscanf(buf, WDT_REASON_LBL ": %s\n", reason->label) == 1)
 			continue;
 		if (sscanf(buf, WDT_REASON_CSE ": %d\n", (int *)&reason->cause) == 1)
 			continue;
-		if (sscanf(buf, WDT_REASON_CNT ": %d\n", &reason->counter) == 1)
+		if (sscanf(buf, WDT_REASON_LBL ": %s\n", reason->label) == 1)
 			continue;
 	}
 	fclose(fp);


fetch: perform prune in separate steps

fetch: perform prune in separate steps

For each remote-tracking branch we want to remove, we need to consider
it against every other refspec in case we have overlapping refspecs,
such as with

    refs/heads/*:refs/remotes/origin/*
    refs/pull/*/head:refs/remotes/origin/pr/*

as we'd otherwise remove too many refspecs.

Create a list of condidates, which are the references matching the rhs
of any active refspec and then filter that list by removing those
entries for which we find a remove reference with any active
refspec. Those which are left after this are removed.

--- src/remote.c
+++ src/remote.c
@@ -1089,75 +1089,142 @@
 	return error;
 }

+/**
+ * Generate a list of candidates for pruning by getting a list of
+ * references which match the rhs of an active refspec.
+ */
+static int prune_candidates(git_vector *candidates, git_remote *remote)
+{
+	git_strarray arr = { 0 };
+	size_t i;
+	int error;
+
+	if ((error = git_reference_list(&arr, remote->repo)) < 0)
+		return error;
+
+	for (i = 0; i < arr.count; i++) {
+		const char *refname = arr.strings[i];
+		char *refname_dup;
+
+		if (!git_remote__matching_dst_refspec(remote, refname))
+			continue;
+
+		refname_dup = git__strdup(refname);
+		GITERR_CHECK_ALLOC(refname_dup);
+
+		if ((error = git_vector_insert(candidates, refname_dup)) < 0)
+			goto out;
+	}
+
+out:
+	git_strarray_free(&arr);
+	return error;
+}
+
+static int find_head(const void *_a, const void *_b)
+{
+	git_remote_head *a = (git_remote_head *) _a;
+	git_remote_head *b = (git_remote_head *) _b;
+
+	return strcmp(a->name, b->name);
+}
+
 int git_remote_prune(git_remote *remote)
 {
-	git_strarray arr = { 0 };
-	size_t i, j, k;
+	size_t i, j;
 	git_vector remote_refs = GIT_VECTOR_INIT;
-	git_refspec *spec;
+	git_vector candidates = GIT_VECTOR_INIT;
+	const git_refspec *spec;
+	const char *refname;
 	int error;
-
-	if ((error = git_reference_list(&arr, remote->repo)) < 0)
-		return error;
+	git_oid zero_id = {{ 0 }};

 	if ((error = ls_to_vector(&remote_refs, remote)) < 0)
 		goto cleanup;

-	git_vector_foreach(&remote->active_refspecs, k, spec) {
-		if (spec->push)
+	git_vector_set_cmp(&remote_refs, find_head);
+
+	if ((error = prune_candidates(&candidates, remote)) < 0)
+		goto cleanup;
+
+	/*
+	 * Remove those entries from the candidate list for which we
+	 * can find a remote reference in at least one refspec.
+	 */
+	git_vector_foreach(&candidates, i, refname) {
+		git_vector_foreach(&remote->active_refspecs, j, spec) {
+			git_buf buf = GIT_BUF_INIT;
+			size_t pos;
+			char *src_name;
+			git_remote_head key = {0};
+
+			if (!git_refspec_dst_matches(spec, refname))
+				continue;
+
+			if ((error = git_refspec_rtransform(&buf, spec, refname)) < 0)
+				goto cleanup;
+
+			key.name = (char *) git_buf_cstr(&buf);
+			error = git_vector_search(&pos, &remote_refs, &key);
+			git_buf_free(&buf);
+
+			if (error < 0 && error != GIT_ENOTFOUND)
+				goto cleanup;
+
+			if (error == GIT_ENOTFOUND)
+				continue;
+
+			/* if we did find a source, remove it from the candiates */
+			if ((error = git_vector_set((void **) &src_name, &candidates, i, NULL)) < 0)
+				goto cleanup;
+
+			git__free(src_name);
+			break;
+		}
+	}
+
+	/*
+	 * For those candidates still left in the list, we need to
+	 * remove them. We do not remove symrefs, as those are for
+	 * stuff like origin/HEAD which will never match, but we do
+	 * not want to remove them.
+	 */
+	git_vector_foreach(&candidates, i, refname) {
+		git_reference *ref;
+		git_oid id;
+
+		if (refname == NULL)
 			continue;

-		for (i = 0; i < arr.count; ++i) {
-			char *prune_ref = arr.strings[i];
-			int found = 0;
-			git_remote_head *remote_ref;
-			git_oid oid;
-			git_reference *ref;
-
-			if (git_refspec_dst_matches(spec, prune_ref) != 1)
-				continue;
-
-			git_vector_foreach(&remote_refs, j, remote_ref) {
-				git_buf buf = GIT_BUF_INIT;
-
-				if (git_refspec_transform(&buf, spec, remote_ref->name) < 0)
-					continue;
-
-				if (!git__strcmp(prune_ref, git_buf_cstr(&buf))) {
-					found = 1;
-					break;
-				}
-			}
-
-			if (found)
-				continue;
-
-			if ((error = git_reference_lookup(&ref, remote->repo, prune_ref)) >= 0) {
-				if (git_reference_type(ref) == GIT_REF_OID) {
-					git_oid_cpy(&oid, git_reference_target(ref));
-					if ((error = git_reference_delete(ref)) < 0) {
-						git_reference_free(ref);
-						goto cleanup;
-					}
-
-					if (remote->callbacks.update_tips != NULL) {
-						git_oid zero_oid;
-
-						memset(&zero_oid, 0, sizeof(zero_oid));
-						if (remote->callbacks.update_tips(prune_ref, &oid, &zero_oid, remote->callbacks.payload) < 0) {
-							git_reference_free(ref);
-							goto cleanup;
-						}
-					}
-				}
-				git_reference_free(ref);
-			}
+		error = git_reference_lookup(&ref, remote->repo, refname);
+		/* as we want it gone, let's not consider this an error */
+		if (error == GIT_ENOTFOUND)
+			continue;
+
+		if (error < 0)
+			goto cleanup;
+
+		if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
+			git_reference_free(ref);
+			continue;
 		}
+
+		git_oid_cpy(&id, git_reference_target(ref));
+		error = git_reference_delete(ref);
+		git_reference_free(ref);
+		if (error < 0)
+			goto cleanup;
+
+		if (remote->callbacks.update_tips)
+			error = remote->callbacks.update_tips(refname, &id, &zero_id, remote->callbacks.payload);
+
+		if (error < 0)
+			goto cleanup;
 	}

 cleanup:
-	git_strarray_free(&arr);
 	git_vector_free(&remote_refs);
+	git_vector_free_deep(&candidates);
 	return error;
 }


Fixed missing error check on call to git_remote_download in git_remote_fetch. Moved error check to statement following git_remote_disconnect so that the disconnect happens regardless of the result of the download call.

--- src/remote.c
+++ src/remote.c
@@ -857,11 +857,14 @@
 	if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH)) != 0)
 		return error;

-	if ((error = git_remote_download(remote)) != 0)
-		return error;
+	error = git_remote_download(remote);

 	/* We don't need to be connected anymore */
 	git_remote_disconnect(remote);
+
+	/* If the download failed, return the error */
+	if (error != 0)
+		return error;

 	/* Default reflog message */
 	if (reflog_message)


teamd: allow to intr team on second SIGINT

Signed-off-by: Jiri Pirko <1b548d10035ae428195c41f5d55eedb1437ccd8a@resnulli.us>

--- teamd/teamd.c
+++ teamd/teamd.c
@@ -378,7 +378,7 @@
 				switch(ctrl_byte) {
 				case 'q':
 					if (quit_in_progress)
-						continue;
+						return -EBUSY;
 					err = teamd_flush_ports(ctx);
 					if (err)
 						return err;


_ribified_sendfile() is now consistant

_ribified_sendfile() is now consistant

with writev: the calling library will deal with partial transfers

--- src/ribify.c
+++ src/ribify.c
@@ -139,23 +139,9 @@

 ssize_t _ribified_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
     ssize_t res;
-    ssize_t t_res = 0;
-
-    for(;;) {
-        res = sendfile(out_fd, in_fd, offset, count);
-        if (0 < res) {
-            t_res += res;
-            count -= res;
-            if (0 == count)
-                break;
-            continue;
-        }
-        if (!yield_if_eagain(out_fd)) {
-            t_res = res;
-            break;
-        }
-    }
-    return t_res;
+    while ((res = sendfile(out_fd, in_fd, offset, count)) < 0 &&
+           yield_if_eagain(out_fd));
+    return res;
 }

 int _ribified_pipe2(int pipefd[2], int flags) {


Included stdarg.h in string_buffer.h to fix compile bug on some platforms

--- string_buffer.h
+++ string_buffer.h
@@ -28,6 +28,7 @@
 #define STRING_BUFFER_FILE_SEEN

 #include <zlib.h> // needed for gzFile
+#include <stdarg.h> // required for va_list

 typedef unsigned long t_buf_pos;
 typedef struct STRING_BUFFER STRING_BUFFER;


stest: default to user 'superuser'

stest: default to user 'superuser'

Signed-off-by: Colin McCabe <3142ce8a0bdba4a38073365893e6b74f72d9c512@alumni.cmu.edu>

--- stest/stest.c
+++ stest/stest.c
@@ -18,6 +18,7 @@
 #include "client/fishc_internal.h"
 #include "common/config/logc.h"
 #include "core/signal.h"
+#include "mds/limits.h"
 #include "stest/stest.h"
 #include "util/compiler.h"
 #include "util/error.h"
@@ -39,7 +40,7 @@
 #include <sys/types.h>
 #include <unistd.h>

-#define STEST_DEFAULT_USER "redfish"
+#define STEST_DEFAULT_USER RF_SUPERUSER_NAME
 #define NUM_PERCENT_DIGITS 3

 static char g_tempdir[PATH_MAX];


Proper verification of the loop counter "for".

--- src/luaconv.c
+++ src/luaconv.c
@@ -180,7 +180,7 @@
     int index, pos;
     PyObject *arg;
     lua_Object larg;
-    for (index = 0; index != nargs; index++) {
+    for (index = 0; index < nargs; index++) {
         pos = index + stackpos + 1;
         larg = lua_getparam(L, pos);
         arg = lua_stack_convert(L, pos, larg);


bug fix converting userdata.

bug fix converting userdata.

--- src/luaconv.c
+++ src/luaconv.c
@@ -234,7 +234,11 @@
     } else if (lua_isuserdata(L, lobj)) {
         void *void_ptr = lua_getuserdata(L, lobj); // userdata NULL ?
         if (void_ptr) {
-            ret = (PyObject *) void_ptr;
+            if (PYTHON_EMBED_MODE) {
+                ret = (PyObject *) void_ptr;
+            } else {
+                ret = LuaObject_PyNew(L, lobj);
+            }
         }  else {
             Py_INCREF(Py_None);
             ret = Py_None;


fixed Downloader not reporting occurred errors for non-curl errors

--- cpp/lib/include/Downloader.h
+++ cpp/lib/include/Downloader.h
@@ -134,7 +134,7 @@
     /** \note Returns \em{all} URLs encountered in downloading the last document, including the original URL. */
     const std::vector<std::string> &getRedirectUrls() const { return redirect_urls_; }

-    bool anErrorOccurred() const { return curl_error_code_ != CURLE_OK; }
+    bool anErrorOccurred() const { return curl_error_code_ != CURLE_OK or not getLastErrorMessage().empty(); }
     CURLcode getLastErrorCode() const { return curl_error_code_; }
     const std::string &getLastErrorMessage() const;
     const std::string &getUserAgent() const { return params_.user_agent_; }


_generator() now returns number of values pushed to stack

The _generator() function now returns an integer telling how many values
it pushed to the lua stack

--- src/lunique.c
+++ src/lunique.c
@@ -26,7 +26,7 @@
     STD, TIME, RANDOM
 } Generators_t;

-static void _generator(lua_State *L, const Generators_t g) {
+static int _generator(lua_State *L, const Generators_t g) {
     uuid_t uuid;
     char str[UUID_LEN];
     if(g == TIME) {
@@ -38,16 +38,15 @@
     }
     uuid_unparse(uuid, str);
     lua_pushlstring(L, str, sizeof(str));
+    return 1;
 }

 static int Lgenerate(lua_State *L) {
-    _generator(L, STD);
-    return 1;
+    return _generator(L, STD);
 }

 static int Lgenerate_time(lua_State *L) {
-    _generator(L, TIME);
-    return 1;
+    return _generator(L, TIME);
 }

 static int Lgenerate_time_safe(lua_State *L) {
@@ -61,8 +60,7 @@
 }

 static int Lgenerate_random(lua_State *L) {
-    _generator(L, RANDOM);
-    return 1;
+    return _generator(L, RANDOM);
 }

 static int Ltime(lua_State *L) {


Fixed MAX_FIELD_LENGTH

Fixed MAX_FIELD_LENGTH

--- cpp/lib/include/MarcRecord.h
+++ cpp/lib/include/MarcRecord.h
@@ -41,7 +41,7 @@
     friend class XmlMarcWriter;
 public:
     static const size_t FIELD_NOT_FOUND = std::numeric_limits<size_t>::max();
-    static const size_t MAX_FIELD_LENGTH = 9999;
+    static const size_t MAX_FIELD_LENGTH = 9998; // Substract size of trailing 0x1E
 private:
     mutable Leader leader_;
     std::vector<DirectoryEntry> directory_entries_;


cpu/sam21_common:i2c: refactor a function to wait for response

--- cpu/sam0_common/periph/i2c.c
+++ cpu/sam0_common/periph/i2c.c
@@ -48,6 +48,7 @@
 static inline int _write(SercomI2cm *dev, const uint8_t *data, int length);
 static inline int _read(SercomI2cm *dev, uint8_t *data, int length);
 static inline void _stop(SercomI2cm *dev);
+static inline int _wait_for_response(SercomI2cm *dev);

 /**
  * @brief Array holding one pre-initialized mutex for each I2C device
@@ -379,8 +380,6 @@

 static int _start(SercomI2cm *dev, uint8_t address, uint8_t rw_flag)
 {
-    uint32_t timeout_counter = 0;
-
     /* Wait for hardware module to sync */
     DEBUG("Wait for device to be ready\n");
     while (dev->SYNCBUSY.reg & SERCOM_I2CM_SYNCBUSY_MASK) {}
@@ -393,13 +392,8 @@
     dev->ADDR.reg = (address << 1) | rw_flag | (0 << SERCOM_I2CM_ADDR_HS_Pos);

     /* Wait for response on bus. */
-    while (!(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB)
-           && !(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) {
-        if (++timeout_counter >= SAMD21_I2C_TIMEOUT) {
-            DEBUG("STATUS_ERR_TIMEOUT\n");
-            return -1;
-        }
-    }
+    if (_wait_for_response(dev) < 0)
+        return -1;

     /* Check for address response error unless previous error is detected. */
     /* Check for error and ignore bus-error; workaround for BUSSTATE
@@ -426,7 +420,6 @@
 static inline int _write(SercomI2cm *dev, const uint8_t *data, int length)
 {
     uint16_t tmp_data_length = length;
-    uint32_t timeout_counter = 0;
     uint16_t buffer_counter = 0;

     /* Write data buffer until the end. */
@@ -444,15 +437,8 @@
         DEBUG("Written byte #%i to data reg, now waiting for DR to be empty again\n", buffer_counter);
         dev->DATA.reg = data[buffer_counter++];

-        DEBUG("Wait for response.\n");
-        timeout_counter = 0;
-        while (!(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB)
-               && !(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) {
-            if (++timeout_counter >= SAMD21_I2C_TIMEOUT) {
-                DEBUG("STATUS_ERR_TIMEOUT\n");
-                return -1;
-            }
-        }
+        if (_wait_for_response(dev) < 0)
+            return -1;

         /* Check for NACK from slave. */
         if (dev->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) {
@@ -465,7 +451,6 @@

 static inline int _read(SercomI2cm *dev, uint8_t *data, int length)
 {
-    uint32_t timeout_counter = 0;
     uint8_t count = 0;

     /* Set action to ack. */
@@ -485,14 +470,9 @@
         data[count] = dev->DATA.reg;

         /* Wait for response. */
-        timeout_counter = 0;
-        while (!(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB)
-               && !(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) {
-            if (++timeout_counter >= SAMD21_I2C_TIMEOUT) {
-                DEBUG("STATUS_ERR_TIMEOUT\n");
-                return -1;
-            }
-        }
+        if (_wait_for_response(dev) < 0)
+            return -1;
+
         count++;
     }
     /* Send NACK before STOP */
@@ -511,4 +491,18 @@
     DEBUG("Stop sent\n");
 }

+static inline int _wait_for_response(SercomI2cm *dev)
+{
+    uint32_t timeout_counter = 0;
+    DEBUG("Wait for response.\n");
+    while (!(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB)
+           && !(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) {
+        if (++timeout_counter >= SAMD21_I2C_TIMEOUT) {
+            DEBUG("STATUS_ERR_TIMEOUT\n");
+            return -1;
+        }
+    }
+    return 0;
+}
+
 #endif /* I2C_NUMOF */


update version number

update version number

--- ITS/AliITSresponse.h
+++ ITS/AliITSresponse.h
@@ -187,7 +187,7 @@
     TString  fFileName3;        // param values or output coded signal
     Bool_t     fWrite;          // Write option for the compression algorithms

-    ClassDef(AliITSresponse,2) // Detector type response virtual base class
+    ClassDef(AliITSresponse,3) // Detector type response virtual base class
 };
 // Input and output function for standard C++ input/output.
 ostream& operator<<(ostream &os,AliITSresponse &source);


fixed compilation on Linux. need to fix X11 server issue on window close.

--- Include/TinyWindow.h
+++ Include/TinyWindow.h
@@ -235,9 +235,6 @@
 		screenResolution.y = HeightOfScreen(
 			XScreenOfDisplay(currentDisplay,
 				DefaultScreen(currentDisplay)));
-
-		isInitialized = true;
-		return true;
 #endif
 	}

@@ -1093,7 +1090,6 @@
 		if (XEventsQueued(currentDisplay, QueuedAfterReading))
 		{
 			XNextEvent(currentDisplay, &currentEvent);
-			XEvent currentEvent = currentEvent;

 			Linux_ProcessEvents(currentEvent);
 		}
@@ -1113,8 +1109,6 @@
 #elif defined(TW_LINUX)
 		//even if there aren't any events to process
 		XNextEvent(currentDisplay, &currentEvent);
-
-		XEvent currentEvent = currentEvent;

 		Linux_ProcessEvents(currentEvent);
 #endif
@@ -2044,7 +2038,7 @@
 		SetCursorPos(mousePoint.x, mousePoint.y);
 #elif defined(TW_LINUX)
 		XWarpPointer(
-			windowManager::GetDisplay(),
+			currentDisplay,
 			window->windowHandle, window->windowHandle,
 			window->position.x, window->position.y,
 			window->resolution.width, window->resolution.height,
@@ -3403,9 +3397,9 @@
 	static int linuxFunction;
 	static int linuxDecorator;

-	static window_t* GetWindowByHandle( Window windowHandle )
-	{
-		for(unsigned int iter = 0; iter < GetInstance()->windowList.size(); iter++ )
+	window_t* GetWindowByHandle( Window windowHandle )
+	{
+		for(unsigned int iter = 0; iter < windowList.size(); iter++ )
 		{
 			if ( windowList[iter]->windowHandle == windowHandle )
 			{
@@ -3415,7 +3409,7 @@
 		return nullptr;
 	}

-	static window_t* GetWindowByEvent( XEvent currentEvent )
+	window_t* GetWindowByEvent( XEvent currentEvent )
 	{
 		switch( currentEvent.type )
 		{
@@ -3506,7 +3500,7 @@
 		}
 	}

-	static void InitializeAtoms( )
+	void InitializeAtoms( )
 	{
 		AtomState = XInternAtom(currentDisplay, "_NET_WM_STATE", false);
 		AtomFullScreen = XInternAtom(currentDisplay, "_NET_WM_STATE_FULLSCREEN", false);
@@ -3537,7 +3531,7 @@
 		AtomDesktopGeometry = XInternAtom(currentDisplay, "_NET_DESKTOP_GEOMETRY", false);
 	}

-	static void Linux_InitializeWindow( window_t* window )
+	void Linux_InitializeWindow( window_t* window )
 	{
 		window->attributes = new int[ 5 ]{
 			GLX_RGBA,
@@ -3599,12 +3593,12 @@
 		Platform_InitializeGL(window);
 	}

-	static void Linux_ShutdownWindow( window_t* window )
+	void Linux_ShutdownWindow( window_t* window )
 	{
 		XDestroyWindow(currentDisplay, window->windowHandle);
 	}

-	static void Linux_Shutdown( void )
+	void Linux_Shutdown( void )
 	{
 		for(unsigned int iter = 0; iter < windowList.size(); iter++)
 		{
@@ -3614,7 +3608,7 @@
 		XCloseDisplay( currentDisplay );
 	}

-	static void Linux_ProcessEvents( XEvent currentEvent )
+	void Linux_ProcessEvents( XEvent currentEvent )
 	{
 		window_t* window = GetWindowByEvent( currentEvent );

@@ -4071,12 +4065,6 @@
 		}
 	}

-	//get pointer to X11 display
-	static Display* GetDisplay( void )
-	{
-		return GetInstance()->currentDisplay;
-	}
-
 	//debugging. used to determine what type of event was generated
 	static const char* Linux_GetEventType( XEvent currentEvent )
 	{
@@ -4487,7 +4475,7 @@
 		PrintErrorMessage( std::error_code(linuxFunctionNotImplemented, errorCategory));
 	}

-	static GLXFBConfig GetBestFrameBufferConfig(window_t* givenWindow)
+	GLXFBConfig GetBestFrameBufferConfig(window_t* givenWindow)
 	{
 		const int visualAttributes[  ] =
 		{


Preparing to extract functions

Preparing to extract functions

--- src/maestro.c
+++ src/maestro.c
@@ -2693,26 +2693,28 @@
    }
    SeqUtil_TRACE(TL_FULL_TRACE, "processDepStatus(): depWildcard=%d\n",depWildcard);
    if( ! depWildcard ) {
-      char statusFile[SEQ_MAXFIELD];
-      memset( statusFile, '\0', sizeof statusFile);
-      /* no wilcard, we check only one iteration */
-      if( dep->exp != NULL ) {
-         sprintf(statusFile,"%s/sequencing/status/%s/%s%s.%s", dep->exp, dep->datestamp,  dep->node_name, depExtension, dep->status );
-      } else {
-         sprintf(statusFile,"%s/sequencing/status/%s/%s%s.%s", _nodeDataPtr->workdir, dep->datestamp, dep->node_name, depExtension, dep->status );
-      }
-
-      SeqUtil_TRACE(TL_FULL_TRACE,"processDepStatus(): statusFile=%s\n",statusFile);
-      ret=_lock( statusFile ,_nodeDataPtr->datestamp, _nodeDataPtr->expHome );
-      if ( (undoneIteration=! _isFileExists( statusFile, "maestro.processDepStatus()", _nodeDataPtr->expHome)) ) {
-         if( dep->exp_scope == InterUser ) {
-            isWaiting = writeInterUserNodeWaitedFile( _nodeDataPtr, dep->node_name, dep->index, depExtension, dep->datestamp, dep->status, dep->exp, dep->protocol, statusFile, _flow);
+      {
+         char statusFile[SEQ_MAXFIELD];
+         memset( statusFile, '\0', sizeof statusFile);
+         /* no wilcard, we check only one iteration */
+         if( dep->exp != NULL ) {
+            sprintf(statusFile,"%s/sequencing/status/%s/%s%s.%s", dep->exp, dep->datestamp,  dep->node_name, depExtension, dep->status );
          } else {
-            isWaiting = writeNodeWaitedFile( _nodeDataPtr, dep->exp, dep->node_name, dep->status, depExtension, dep->datestamp, dep->exp_scope, statusFile);
+            sprintf(statusFile,"%s/sequencing/status/%s/%s%s.%s", _nodeDataPtr->workdir, dep->datestamp, dep->node_name, depExtension, dep->status );
          }
-      }
-      SeqUtil_TRACE(TL_FULL_TRACE,"processDepStatus(): After checking calling Write...WaitedFile(), isWaiting=%d\n",isWaiting);
-      ret=_unlock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
+
+         SeqUtil_TRACE(TL_FULL_TRACE,"processDepStatus(): statusFile=%s\n",statusFile);
+         ret=_lock( statusFile ,_nodeDataPtr->datestamp, _nodeDataPtr->expHome );
+         if ( (undoneIteration=! _isFileExists( statusFile, "maestro.processDepStatus()", _nodeDataPtr->expHome)) ) {
+            if( dep->exp_scope == InterUser ) {
+               isWaiting = writeInterUserNodeWaitedFile( _nodeDataPtr, dep->node_name, dep->index, depExtension, dep->datestamp, dep->status, dep->exp, dep->protocol, statusFile, _flow);
+            } else {
+               isWaiting = writeNodeWaitedFile( _nodeDataPtr, dep->exp, dep->node_name, dep->status, depExtension, dep->datestamp, dep->exp_scope, statusFile);
+            }
+         }
+         SeqUtil_TRACE(TL_FULL_TRACE,"processDepStatus(): After checking calling Write...WaitedFile(), isWaiting=%d\n",isWaiting);
+         ret=_unlock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
+      }
    } else {
       /* wildcard, we need to check for all iterations and stop on the first iteration that is not done */
       /* get all the node extensions to be checked */
@@ -2722,28 +2724,30 @@

       /* loop iterations until we find one that is not satisfied */
       while( extensions != NULL && undoneIteration == 0 ) {
-         char statusFile[SEQ_MAXFIELD];
-         memset( statusFile, '\0', sizeof statusFile);
-         if( dep->exp != NULL ) {
-            sprintf(statusFile,"%s/sequencing/status/%s/%s.%s.%s", dep->exp, dep->datestamp, dep->node_name, extensions->data, dep->status );
-         } else {
-            sprintf(statusFile,"%s/sequencing/status/%s/%s.%s.%s", _nodeDataPtr->workdir, dep->datestamp, dep->node_name, extensions->data, dep->status );
+         currentIndexPtr = extensions->data;
+         {
+            char statusFile[SEQ_MAXFIELD];
+            memset( statusFile, '\0', sizeof statusFile);
+            if( dep->exp != NULL ) {
+               sprintf(statusFile,"%s/sequencing/status/%s/%s.%s.%s", dep->exp, dep->datestamp, dep->node_name, extensions->data, dep->status );
+            } else {
+               sprintf(statusFile,"%s/sequencing/status/%s/%s.%s.%s", _nodeDataPtr->workdir, dep->datestamp, dep->node_name, extensions->data, dep->status );
+            }
+
+            SeqUtil_TRACE(TL_FULL_TRACE, "processDepStatus(): Iterating over extensions list: current=%s, filename=%s\n",extensions->data,statusFile);
+
+            ret=_lock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
+            if( ! (undoneIteration = ! _isFileExists( statusFile, "maestro.processDepStatus()", _nodeDataPtr->expHome))) {
+               extensions = extensions->nextPtr; /* the iteration status file exists, go to next */
+            } else {
+               if( dep->exp_scope == InterUser ) {
+                  isWaiting = writeInterUserNodeWaitedFile( _nodeDataPtr, dep->node_name, dep->index, currentIndexPtr, dep->datestamp, dep->status, dep->exp, dep->protocol, statusFile, _flow);
+               } else {
+                  isWaiting = writeNodeWaitedFile( _nodeDataPtr, dep->exp, dep->node_name, dep->status, currentIndexPtr, dep->datestamp, dep->exp_scope, statusFile);
+               }
+            }
+            ret=_unlock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
          }
-
-         SeqUtil_TRACE(TL_FULL_TRACE, "processDepStatus(): Iterating over extensions list: current=%s, filename=%s\n",extensions->data,statusFile);
-
-         ret=_lock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
-         if( ! (undoneIteration = ! _isFileExists( statusFile, "maestro.processDepStatus()", _nodeDataPtr->expHome))) {
-            extensions = extensions->nextPtr; /* the iteration status file exists, go to next */
-         } else {
-            currentIndexPtr = extensions->data;
-            if( dep->exp_scope == InterUser ) {
-               isWaiting = writeInterUserNodeWaitedFile( _nodeDataPtr, dep->node_name, dep->index, currentIndexPtr, dep->datestamp, dep->status, dep->exp, dep->protocol, statusFile, _flow);
-            } else {
-               isWaiting = writeNodeWaitedFile( _nodeDataPtr, dep->exp, dep->node_name, dep->status, currentIndexPtr, dep->datestamp, dep->exp_scope, statusFile);
-            }
-         }
-         ret=_unlock( statusFile , _nodeDataPtr->datestamp, _nodeDataPtr->expHome );
       }
       SeqListNode_deleteWholeList(&extensions);
    }


更改公共文件

更改公共文件

--- FirstProjects/FirstProjects/FirstProjects/PublicHead.h
+++ FirstProjects/FirstProjects/FirstProjects/PublicHead.h
@@ -8,14 +8,14 @@

 #ifndef PublicHead_h
 #define PublicHead_h
-#import "Color+Hex.h"
-#import "DesUtil.h"
-#import "HJTNetTool.h"
-#import "NSObject+HKExtension.h"
-#import "MD5Encrypted.h"
-#import "WZHNavigationViewController.h"
-#import "YBUnlimitedSlideViewController.h"
-#import "ZHBaseViewController.h"
+#import "Color+Hex/Color+Hex.h"
+#import "des/DesUtil.h"
+#import "HJTNetTool/HJTNetTool.h"
+#import "HKExtension/NSObject+HKExtension.h"
+#import "md5/MD5Encrypted.h"
+#import "NavgationController/WZHNavigationViewController.h"
+#import "YBUnlimitedSlideViewController/YBUnlimitedSlideViewController.h"
+#import "ZHBaseTabBar/ZHBaseViewController.h"
 #import <MBProgressHUD/MBProgressHUD.h>
 #import <YYKit/YYKit.h>
 #import <Masonry/Masonry.h>


fix ex4

fix ex4

--- chapter_1/ex4.c
+++ chapter_1/ex4.c
@@ -14,14 +14,14 @@

     ratio = 9.0 / 5.0;

-    celcius = lower;
+    celsius = lower;

     printf("This is a simple program that converts\n");
     printf("Fahrenheit to Celsius in decimal format\n");

     while (celsius <= upper) {
-        fahr = celcius * ratio + 32;
-        printf("Fahrenheit: %6.2f Celsius: %3.1f\n", fahr, celcius);
+        fahr = celsius * ratio + 32;
+        printf("Fahrenheit: %6.2f Celsius: %3.1f\n", fahr, celsius);
         celsius = celsius + step;
     }
     return 0;


* Fix to the slave AI problem, by Skotlex

git-svn-id: c1e39603916b71782cde5facdf0b79eff05c1414@6742 54d463be-8e91-2dee-dedb-b68131a5f0ec

--- src/map/mob.c
+++ src/map/mob.c
@@ -679,7 +679,7 @@
 	if (!md->level) // [Valaris]
 		md->level=md->db->lv;

-	md->master_id = 0;
+//	md->master_id = 0;
 	md->master_dist = 0;

 	md->state.aggressive = md->db->mode&MD_ANGRY?1:0;


Include proper BP values for the Bees on a Chaos Sorcerer.

--- src/mapdata.c
+++ src/mapdata.c
@@ -330,9 +330,17 @@
                 gen[count].rt_index = 0x1E;
                 break;

-            case 0x00A1:    /* Chaos Sorcerer + 2 Bits */
+            case 0x00A1:    /* Chaos Sorcerer */
                 gen[count].bp_entry = 0x0A;
                 gen[count].rt_index = 0x1F;
+
+                /* Bee L */
+                gen[count + 1].bp_entry = 0x0B;
+                gen[count + 1].rt_index = 0x00;
+
+                /* Bee R */
+                gen[count + 2].bp_entry = 0x0C;
+                gen[count + 2].rt_index = 0x00;
                 count += 2;
                 break;


rubber: without MADV_HUGEPAGE, set PAGE_SIZE to 4 kB

--- src/rubber.c
+++ src/rubber.c
@@ -108,7 +108,11 @@
     struct rubber_table *table;
 };

+#ifdef MADV_HUGEPAGE
 static const size_t PAGE_SIZE = 2 * 1024 * 1024;
+#else
+static const size_t PAGE_SIZE = 4 * 1024;
+#endif

 gcc_const
 static inline size_t


crush: fix recursion through intervening types

This fixes pretty core behavior when doing recursion down the tree.  I
suspect it was broken when changing the retry behavior.

Signed-off-by: Sage Weil <6dd34506bbd5e58221bbb3e4732d97c91f02277b@newdream.net>

--- src/crush/mapper.c
+++ src/crush/mapper.c
@@ -368,6 +368,7 @@
 					BUG_ON(item >= 0 ||
 					       (-1-item) >= map->max_buckets);
 					in = map->buckets[-1-item];
+					retry_bucket = 1;
 					continue;
 				}


Reduce duplicate knowledge of lightweight locks within appendonlywriter.

--- src/backend/access/appendonly/appendonlywriter.c
+++ src/backend/access/appendonly/appendonlywriter.c
@@ -64,6 +64,16 @@
 static bool *get_awaiting_drop_status_from_segments(Relation parentrel);
 static int64 *GetTotalTupleCountFromSegments(Relation parentrel, int segno);

+static void
+acquire_lightweight_lock() {
+	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+}
+
+static void
+release_lightweight_lock() {
+	LWLockRelease(AOSegFileLock);
+}
+
 /*
  * AppendOnlyWriterShmemSize -- estimate size the append only writer structures
  * will need in shared memory.
@@ -189,7 +199,7 @@
 	 * Momentarily release the AOSegFileLock so we can safely access the
 	 * system catalog (i.e. without risking a deadlock).
 	 */
-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();

 	SIMPLE_FAULT_INJECTOR(BeforeCreatingAnAOHashEntry);

@@ -221,7 +231,7 @@
 	 *
 	 * Note: Another session may have raced-in and created it.
 	 */
-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoHashEntry = AppendOnlyRelHashNew(relid, &exists);

@@ -436,7 +446,7 @@
 	 */
 	if (!AORelCreateHashEntry(relid))
 	{
-		LWLockRelease(AOSegFileLock);
+		release_lightweight_lock();
 		ereport(ERROR, (errmsg("can't have more than %d different append-only "
 							   "tables open for writing data at the same time. "
 							   "if tables are heavily partitioned or if your "
@@ -699,7 +709,7 @@
 		return;
 	}

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoentry = AORelGetOrCreateHashEntry(relid);
 	Assert(aoentry);
@@ -723,7 +733,7 @@
 		}
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 	return;
 }

@@ -745,7 +755,7 @@
 		return;
 	}

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoentry = AORelGetOrCreateHashEntry(relid);
 	Assert(aoentry);
@@ -771,7 +781,7 @@
 		}
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 	return;
 }

@@ -842,7 +852,7 @@
 		pfree(total_tupcount);
 	}

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoentry = AORelGetOrCreateHashEntry(RelationGetRelid(rel));
 	Assert(aoentry);
@@ -954,7 +964,7 @@
 						  RelationGetRelationName(rel), RelationGetRelid(rel))));
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();

 	Assert(usesegno >= 0 || usesegno == APPENDONLY_COMPACTION_SEGNO_INVALID);

@@ -1004,7 +1014,7 @@
 					  "relation \"%s\" (%d)",
 					  RelationGetRelationName(rel), RelationGetRelid(rel))));

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoentry = AORelGetOrCreateHashEntry(RelationGetRelid(rel));
 	Assert(aoentry);
@@ -1055,7 +1065,7 @@

 	if (!segno_chosen)
 	{
-		LWLockRelease(AOSegFileLock);
+		release_lightweight_lock();
 		ereport(ERROR, (errmsg("could not find segment file to use for "
 							   "inserting into relation %s (%d).",
 							   RelationGetRelationName(rel), RelationGetRelid(rel))));
@@ -1066,7 +1076,7 @@
 	aoentry->relsegfiles[usesegno].state = INSERT_USE;
 	aoentry->relsegfiles[usesegno].xid = CurrentXid;

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 	appendOnlyInsertXact = true;

 	Assert(usesegno >= 0);
@@ -1145,7 +1155,7 @@
 							  "relation \"%s\" (%d) ",
 							  RelationGetRelationName(rel), RelationGetRelid(rel))));

-			LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+			acquire_lightweight_lock();

 			aoentry = AORelGetOrCreateHashEntry(RelationGetRelid(rel));
 			Assert(aoentry);
@@ -1214,7 +1224,7 @@

 			if (!segno_chosen)
 			{
-				LWLockRelease(AOSegFileLock);
+				release_lightweight_lock();
 				ereport(ERROR, (errmsg("could not find segment file to use for "
 									   "inserting into relation %s (%d).",
 									   RelationGetRelationName(rel), RelationGetRelid(rel))));
@@ -1224,7 +1234,7 @@
 			aoentry->relsegfiles[usesegno].state = INSERT_USE;
 			aoentry->relsegfiles[usesegno].xid = CurrentXid;

-			LWLockRelease(AOSegFileLock);
+			release_lightweight_lock();
 			appendOnlyInsertXact = true;

 			Assert(usesegno >= 0);
@@ -1746,7 +1756,7 @@
 	/* We should have an XID if we modified AO tables */
 	Assert(CurrentXid != InvalidTransactionId);

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	/*
 	 * for each AO table hash entry
@@ -1804,7 +1814,7 @@
 		}
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 }

 /*
@@ -1836,7 +1846,7 @@

 	hash_seq_init(&status, AppendOnlyHash);

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	/*
 	 * for each AO table hash entry
@@ -1883,7 +1893,7 @@
 		}
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 }

 /*
@@ -2049,7 +2059,7 @@

 	hash_seq_init(&status, AppendOnlyHash);

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	/*
 	 * for each AO table hash entry
@@ -2059,10 +2069,11 @@
 		AtEOXact_AppendOnly_Relation(aoentry, CurrentXid);
 	}

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();

 	appendOnlyInsertXact = false;
 }
+

 /*
  * Fetches a record from the in memory AO Rel Hash
@@ -2072,10 +2083,10 @@
  */
 void
 GpFetchEntryFromAppendOnlyHash(Oid relid, AORelHashEntry foundAoEntry) {
-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();
 	AORelHashEntry aoentry = AORelGetHashEntry(relid);
 	memcpy(foundAoEntry, aoentry, sizeof(AORelHashEntryData));
-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();
 }

@@ -2103,19 +2114,19 @@
 	bool removeWasSuccess;
 	AORelHashEntry aoentry;

-	LWLockAcquire(AOSegFileLock, LW_EXCLUSIVE);
+	acquire_lightweight_lock();

 	aoentry = AORelGetHashEntry(relid);

 	if (aoentry->txns_using_rel != 0) {
-		LWLockRelease(AOSegFileLock);
+		release_lightweight_lock();
 		entry_in_use_error(relid, aoentry->txns_using_rel);
 		return;
 	}

 	removeWasSuccess = AORelRemoveHashEntry(relid);

-	LWLockRelease(AOSegFileLock);
+	release_lightweight_lock();

 	if (removeWasSuccess)
 		successfully_removed_ao_entry(relid);


FIX: c_resolve: Set rc=QUVI_OK

FIX: c_resolve: Set rc=QUVI_OK

--- src/curl/resolve.c
+++ src/curl/resolve.c
@@ -55,6 +55,8 @@

       if (g_strcmp0(r->url.addr->str, u) != 0)
         g_string_assign(r->url.dst, u);
+
+      rc = QUVI_OK;
     }
   else
     {


more verbosity

more verbosity

--- src/runzip.c
+++ src/runzip.c
@@ -14,7 +14,7 @@
  * Convert a string of the given length from (from_enc)
  * to (to_enc) character encoding.
  */
-static char *convert(char *str, size_t len, const char *from_enc, const char *to_enc) {
+static char *convert(char *str, size_t len, const char *from_enc, const char *to_enc, int verbose) {

     size_t outlen = 6 * len;
     char *outstr = malloc(outlen + 1);
@@ -27,10 +27,15 @@
         free(outstr);
         outstr = NULL;
     } else {
+        char *original = str;
         ir = iconv(ic, &str, &len, &op, &outlen);
         ie = errno;
         iconv_close(ic);
         if(ir == -1) {
+            if(verbose >= 2) {
+                printf("    Failed to convert \"%s\" (%s -> %s) near \"%s\": \"%s\"\n",
+                    original, from_enc, to_enc, str, strerror(errno));
+            }
             free(outstr);
             outstr = NULL;
         } else {
@@ -160,7 +165,7 @@
     for(ei = 0; ei < NUM_ENCODINGS; ei++) {
         memset(&freqs[ei], 0, sizeof(freqs[0]));
         freqs[ei].encoding = try_encodings[ei];
-        char *out = convert(str, len, try_encodings[ei], "KOI8-U");
+        char *out = convert(str, len, try_encodings[ei], "KOI8-U", verbose);
         if(!out) continue;  /* Could not convert */
         const char *p;
         /* Fill out a frequency table */
@@ -221,7 +226,8 @@
                 fName, source_encoding, target_encoding);
         }

-        char *nName = convert(fName, fSize, source_encoding, target_encoding);
+        char *nName = convert(fName, fSize, source_encoding, target_encoding,
+                              verbose);
         if(!nName) {
             printf("  Failed to recode \"%s\" (%s -> %s): \"%s\"\n",
                 fName, source_encoding, target_encoding, strerror(errno));
@@ -297,7 +303,7 @@
             dry_run = 1;
             break;
         case 'v':
-            verbose = 1;
+            verbose++;
             break;
         case 's': {
             source_encoding = optarg;


Supply missing compatibility definitions

--- src/sc_mpi.h
+++ src/sc_mpi.h
@@ -74,6 +74,7 @@
 #define sc_MPI_COMM_NULL           MPI_COMM_NULL
 #define sc_MPI_COMM_WORLD          MPI_COMM_WORLD
 #define sc_MPI_COMM_SELF           MPI_COMM_SELF
+#define sc_MPI_COMM_TYPE_SHARED    MPI_COMM_TYPE_SHARED

 #define sc_MPI_GROUP_NULL          MPI_GROUP_NULL
 #define sc_MPI_GROUP_EMPTY         MPI_GROUP_EMPTY
@@ -152,6 +153,7 @@
 #define sc_MPI_Comm_dup            MPI_Comm_dup
 #define sc_MPI_Comm_create         MPI_Comm_create
 #define sc_MPI_Comm_split          MPI_Comm_split
+#define sc_MPI_Comm_split_type     MPI_Comm_split_type
 #define sc_MPI_Comm_free           MPI_Comm_free
 #define sc_MPI_Comm_size           MPI_Comm_size
 #define sc_MPI_Comm_rank           MPI_Comm_rank


small fix

small fix

--- src/mdarray.h
+++ src/mdarray.h
@@ -189,7 +189,9 @@
         ~mdarray_base()
         {
             deallocate();
+            #ifdef _GPU_
             deallocate_on_device();
+            #endif
         }

         /// Copy constructor is forbidden


Fixed typo.

Fixed typo.

--- src/memtest.c
+++ src/memtest.c
@@ -129,7 +129,7 @@
     }
     memtest_test(megabytes,passes);
     printf("\nYour memory passed this test.\n");
-    printf("Please if you are stil in doubt use the following two tools:\n");
+    printf("Please if you are still in doubt use the following two tools:\n");
     printf("1) memtest86: http://www.memtest86.com/\n");
     printf("2) memtester: http://pyropus.ca/software/memtester/\n");
     exit(0);


fixed commit for issue #283

fixed commit for issue #283

--- src/message.c
+++ src/message.c
@@ -655,7 +655,7 @@
     CHECK_PTR(OCI_IPC_VOID, id)
     CHECK_PTR(OCI_IPC_VOID, len)

-    unsigned int max_len = 0;
+    unsigned int max_len = *len;
     *len = 0;

     if (msg->id)


Added explicit instructions for exiting to RPL

--- src/scheme.c
+++ src/scheme.c
@@ -143,7 +143,7 @@

 // not a typo, just a READ-PRINT-LOOP :)
 void rpl(vm_t *vm) {
-    fprintf(stdout, "|Scheme 0.0 - RPL|\n");
+    fprintf(stdout, "|Scheme 0.0 - RPL|\n|Use ^D to exit !|\n");
     char buf[256];
     while (true) {
         fprintf(stdout, ">> ");
@@ -153,6 +153,7 @@
         value_t val = read_source(vm, buf);
         test_write(val);
     }
+    fprintf(stdout, "\nQuiting!\n");
 }

 int main(void) {


Still doesn't work

Still doesn't work

--- src/screen.c
+++ src/screen.c
@@ -64,13 +64,12 @@
       unsigned char a = *SCREEN_ADDR64(screen_mem, sx<<3, y);
 #ifdef SCREEN_SCALE2X
       unsigned short b = screen_lookup[a];
-      unsigned short bx = (sx<<4)+SCREEN_OFFX;
+      unsigned short bx = ((sx<<4)+(SCREEN_OFFX))&(~1);
       unsigned short by = (y<<1)+SCREEN_OFFY;
-      bx <<= bx >> 4;
       *(unsigned short*)SCREEN_ADDR240(LCD_MEM, bx, by) = b;
       *(unsigned short*)SCREEN_ADDR240(LCD_MEM, bx, by+1) = b;
 #else
-      *SCREEN_ADDR240(LCD_MEM, (sx<<3)+(SCREEN_OFFX>>3)<<3, y+SCREEN_OFFY) = a;
+      *SCREEN_ADDR240(LCD_MEM, (sx<<3)+SCREEN_OFFX, y+SCREEN_OFFY) = a;
 #endif
     }
   }


script: drop clock() function

script: drop clock() function

Unused and not much useful given os.clock().

--- src/script.c
+++ src/script.c
@@ -72,7 +72,6 @@
 static int hype_UDP(lua_State *L);
 static int hype_TCP(lua_State *L);
 static int hype_Raw(lua_State *L);
-static int hype_clock(lua_State *L);
 static int hype_cookie16(lua_State *L);
 static int hype_cookie32(lua_State *L);
 static int hype_print(lua_State *L);
@@ -84,7 +83,6 @@
 	{ "UDP",      hype_UDP      },
 	{ "TCP",      hype_TCP      },
 	{ "Raw",      hype_Raw      },
-	{ "clock",    hype_clock    },
 	{ "cookie16", hype_cookie16 },
 	{ "cookie32", hype_cookie32 },
 	{ "print",    hype_print    },
@@ -440,13 +438,6 @@
 	args = lua_touserdata(L, -1);

 	return pkt_cookie(saddr.s_addr, daddr.s_addr, sport, dport, args->seed);
-}
-
-static int hype_clock(lua_State *L) {
-	uint64_t clock = time_now();
-	lua_pushnumber(L, (uint32_t) clock);
-
-	return 1;
 }

 static int hype_cookie16(lua_State *L) {