error: pathspec 'C/Function/Static.c' did not match any file(s) known to git

--- C/Function/Static.c
+++ C/Function/Static.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+static int externa = 1;
+
+static void teste() {
+    int x = 0;
+    static int estatica = 0;
+    x++;
+    estatica++;
+    printf("x = %d, estatica = %d, externa = %d\n", x, estatica, externa);
+}
+int main() {
+	printf("externa = %d\n", externa);
+    for (int i = 0; i < 10; i++) teste();
+}
+
+//https://pt.stackoverflow.com/q/171410/101


Fix some signatures.

Fix some signatures.

--- examples/simple_common.h
+++ examples/simple_common.h
@@ -3,7 +3,7 @@
 #include "cno.h"

-void log_frame(int fd, cno_frame_t *frame, int recv)
+void log_frame(int fd, const cno_frame_t *frame, int recv)
 {
     const char *e = recv ? "recv" : "sent";
     fprintf(stdout, "%d: %s frame %x (%s; length=%lu; flags=%x) on stream %lu\n", fd, e,
@@ -11,7 +11,7 @@
 }

-void log_message(int fd, cno_message_t *msg, int recv)
+void log_message(int fd, const cno_message_t *msg, int recv)
 {
     const char *e = recv ? "recv" : "sent";
     fprintf(stdout, "%d: %s message [code = %d, method = ", fd, e, msg->code);
@@ -30,14 +30,14 @@
 }

-int log_recv_frame(cno_connection_t *conn, void *fd, cno_frame_t *frame)
+int log_recv_frame(cno_connection_t *conn, void *fd, const cno_frame_t *frame)
 {
     log_frame(*(int *) fd, frame, 1);
     return CNO_OK;
 }

-int log_sent_frame(cno_connection_t *conn, void *fd, cno_frame_t *frame)
+int log_sent_frame(cno_connection_t *conn, void *fd, const cno_frame_t *frame)
 {
     log_frame(*(int *) fd, frame, 0);
     return CNO_OK;
@@ -56,7 +56,7 @@
 }

-int log_recv_message(cno_connection_t *conn, void *fd, size_t stream, cno_message_t *msg)
+int log_recv_message(cno_connection_t *conn, void *fd, size_t stream, const cno_message_t *msg)
 {
     log_message(*(int *) fd, msg, 1);
     return CNO_OK;


Pequenas mudanças na organização do código

--- freq_distribution.c
+++ freq_distribution.c
@@ -7,7 +7,6 @@
 	for (i=0; i<n; i++)
 	{
 		f=1; //f ja eh inicializado com 1 pois se o numero ja foi entrado, sua frequencia eh no minimo 1
-		//aux=vet[i];
 		for (j=i+1; j<n; j++)
 		{
 			if (vet[j]==vet[i])
@@ -16,9 +15,8 @@
 				freq[j] = -1; /*marca as posicoes do vetor freq com -1 quando a posicao se repete,
 para que possa armazenar a frequencia de cada numero apenas uma vez, e depois poder acha-las mais facilmente */
 			}
-
 		}
-		freq[i]=f;
+		freq[i]=f; //armazena a frequencia do numero no vetor de frequencias
 	}
 }

@@ -27,7 +25,7 @@
 esses numeros sejam encontrados e impressos */
 freqscan(int vet[], int freq[], int n)
 {
-	int i, j, m=0;//m sera o valor comparado para achar o maior valor de freq[]
+	int i, j, m=0;// m sera o valor comparado para achar o maior valor de freq[]
 	for (i=0; i<n; i++)
 	{
 		if (freq[i]>m)
@@ -56,7 +54,7 @@
 		scanf("%d", &n);
 	}
 	vet=(int*)malloc(n*sizeof(int));//chama malloc uma vez para o vetor vet e outra para o vetor freq
-	freq=(int*)malloc(n*sizeof(int));//cria dois vetores diferentes do mesmo tamanho
+	freq=(int*)malloc(n*sizeof(int));//cria dois vetores diferentes do mesmo tamanho, um vet e outro freq
 	printf("Digite os numeros: ");
 	for (k=0; k<n; k++) //preenche o vetor
 	scanf("%d", &vet[k]);


add c code snippet for check little endian or big endian

error: pathspec '01_chapter/show_byte.c' did not match any file(s) known to git

--- 01_chapter/show_byte.c
+++ 01_chapter/show_byte.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+typedef unsigned char *byte_pointer;
+
+void show_bytes(byte_pointer start, int length)
+{
+	int i;
+	for(i=0;i<length;i++)
+		printf("%.2x", start[i]);
+
+	printf("\n");
+}
+
+int main()
+{
+	int x = 128000;
+	show_bytes(&x, sizeof(int));
+
+	float y = 1.0;
+	show_bytes(&y, sizeof(float));
+
+	return 0;
+}


start on bar potential

start on bar potential

error: pathspec 'galpy/potential_src/potential_c_ext/DehnenBarPotential.c' did not match any file(s) known to git

--- galpy/potential_src/potential_c_ext/DehnenBarPotential.c
+++ galpy/potential_src/potential_c_ext/DehnenBarPotential.c
@@ -0,0 +1,17 @@
+#include <galpy_potentials.h>
+//DehnenBarPotential
+//
+double DehnenBarPotentialRforce(double R,double phi,double t,
+				      int nargs, double *args){
+  //Get args
+  double amp= *args++;
+  //Calculate Rforce
+  return 0.;
+}
+double DehnenBarPotentialphiforce(double R,double phi,double t,
+				      int nargs, double *args){
+  //Get args
+  double amp= *args++;
+  //Calculate phiforce
+  return 0.;
+}


bugfix: improperly constructed default string from 0 rather than ""

--- apps/common/xml/XML.h
+++ apps/common/xml/XML.h
@@ -64,7 +64,7 @@
       }

       /*! return value of property with given name if present, else return 'fallbackValue' */
-      inline std::string getProp(const std::string &name, const std::string &fallbackValue=0) const {
+      inline std::string getProp(const std::string &name, const std::string &fallbackValue="") const {
         for (size_t i = 0; i < prop.size(); i++)
           if (prop[i]->name == name) return prop[i]->value;
         return fallbackValue;


tracelib: comment debug code

tracelib: comment debug code

git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@100071 d073be05-634f-4543-b044-5fe20cf6d1d6

--- src/pextlib1.0/tracelib.c
+++ src/pextlib1.0/tracelib.c
@@ -342,7 +342,7 @@

 		t = depends;
 		for (; *t; t += strlen(t) + 1) {
-			fprintf(stderr, "trace: %s =?= %s\n", t, port);
+			/* fprintf(stderr, "trace: %s =?= %s\n", t, port); */
 			if (!strcmp(t, port)) {
 				resolution = '+';
 				break;


Fix the bug in 'Delete existing TFT' (#358)

--- src/pgw/pgw-s5c-handler.c
+++ src/pgw/pgw-s5c-handler.c
@@ -515,7 +515,7 @@
         /* No operation */
     } else if (tft.code == OGS_GTP_TFT_CODE_DELETE_EXISTING_TFT) {
         pgw_pf_remove_all(bearer);
-        tft_delete = 0;
+        tft_delete = 1;
     } else if (tft.code ==
             OGS_GTP_TFT_CODE_REPLACE_PACKET_FILTERS_IN_EXISTING) {
         for (i = 0; i < tft.num_of_packet_filter; i++) {


Remove country_lookup app

Remove country_lookup app

It's not very useful - we should make a separate benchmark suite

--- apps/country_lookup.c
+++ apps/country_lookup.c
@@ -1,76 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "MMDB.h"
-#include "MMDB_Helper.h"
-#include "getopt.h"
-
-// country lookup is not useful, it is just to see how fast it is compared to
-// 106
-
-int main(int argc, char *const argv[])
-{
-    int verbose = 0;
-    int character;
-    char *fname = NULL;
-    MMDB_s *mmdb;
-    uint16_t status;
-    uint16_t mode;
-
-    while ((character = getopt(argc, argv, "vf:")) != -1) {
-        switch (character) {
-        case 'v':
-            verbose = 1;
-            break;
-        case 'f':
-            fname = strdup(optarg);
-            break;
-        default:
-        case '?':
-            usage(argv[0]);
-        }
-    }
-    argc -= optind;
-    argv += optind;
-
-    fname = fname ? fname :MMDB_DEFAULT_DATABASE;
-    status = MMDB_open(fname, MMDB_MODE_MEMORY_CACHE, mmdb);
-
-    for (int i = 1; i <= 10000000; i++) {
-
-        MMDB_lookup_result_s root = {.entry.mmdb = mmdb };
-//    int err = MMDB_lookup_by_ipnum(404232216, &root);
-        uint32_t ipnum = htonl(rand());
-        int err = MMDB_lookup_by_ipnum(ipnum, &root);
-        if (err == MMDB_SUCCESS) {
-            char *name, *code;
-            if (root.entry.offset > 0) {
-                MMDB_return_s country;
-                MMDB_get_value(&root.entry, &country, "country", NULL);
-                MMDB_entry_s start = {.mmdb = mmdb,.offset = country.offset };
-                if (country.offset) {
-                    MMDB_return_s res;
-                    MMDB_get_value(&start, &res, "code", NULL);
-                    code = bytesdup(mmdb, &res);
-                    MMDB_get_value(&start, &res, "name", "en", NULL);
-                    name = bytesdup(mmdb, &res);
-
-//                    printf( "%u %s %s\n", ipnum , code, name);
-
-                    if (name)
-                        free(name);
-                    if (code)
-                        free(code);
-                }
-            } else {
-                ;               // not found
-            }
-        }
-    }
-
-    if (fname)
-        free(fname);
-
-    return (0);
-}


Fixed node::~node() lacking virtual definition

--- CalcLib/core/tree.h
+++ CalcLib/core/tree.h
@@ -42,7 +42,7 @@
 		void deleteSubNodes();
 		node();
 		node(nodeDataInterface* val);
-		~node();
+		virtual ~node();
 		void set(nodeDataInterface* data);
 		node(const node&);
 		node(node&&);
@@ -72,6 +72,7 @@
 		rootNode& operator=(const rootNode& sourceNode);
 		rootNode(rootNode&& sourceNode);
 		rootNode& operator=(rootNode&& sourceNode);
+
 	};

 	void display_tree(rootNode tree);


Added the unit 'gmol' to the list of recognized units. Added more accuracy to the eV unit.


addition to previous commit: Fixed bugs in IO.cpp; added countPalindromes() method to StringUtils. Implemented HashMap class based on MikeMirzayanov oaht::hash_map

error: pathspec 'HashMap.h' did not match any file(s) known to git

--- HashMap.h
+++ HashMap.h
@@ -0,0 +1,131 @@
+#pragma once
+#include "Head.h"
+
+namespace oaht
+{
+
+	using std::size_t;
+
+	enum class node_state {
+		FREE,
+		IN_USE,
+		ERASED
+	};
+
+	template<typename _Key, typename _Value>
+	struct node {
+		_Key key;
+		_Value value;
+		node_state state = node_state::FREE;
+	};
+
+	template<typename _Key, typename _Value, typename _Hash = std::hash<_Key>>
+	class hash_map {
+	public:
+		hash_map(size_t capacity) : capacity(capacity), size(0) {
+			nodes = new node<_Key, _Value>[capacity];
+
+			for (size_t i = 0; i < capacity; i++)
+				nodes[i] = node<_Key, _Value>();
+		}
+
+		hash_map() : hash_map(3) {
+		}
+
+		size_t count(const _Key& key) const {
+			size_t index = get_index(key, capacity);
+
+			for (size_t d = 0; d < capacity; d++) {
+				if (nodes[index].state == node_state::FREE)
+					return false;
+				if (nodes[index].state == node_state::IN_USE
+					&& nodes[index].key == key)
+					return true;
+				index++;
+				if (index == capacity)
+					index = 0;
+			}
+
+			return false;
+		}
+
+		_Value& operator[](const _Key& key) {
+			if ((size << 1) > capacity)
+				rehash();
+
+			size_t index;
+			bool result = put(key, index, nodes, capacity);
+			if (result)
+				size++;
+
+			return nodes[index].value;
+		}
+
+		void clear() {
+			for (size_t d = 0; d < capacity; d++) {
+				nodes[d].state = node_state::FREE;
+			}
+			size = 0;
+		}
+
+		~hash_map() {
+			delete[] nodes;
+		}
+
+		size_t capacity;
+		size_t size;
+
+		node<_Key, _Value>* nodes;
+
+	private:
+		size_t get_index(const _Key& key, size_t size) const {
+			return (h(key) * 22543) % size;
+		}
+
+		void rehash() {
+			size_t n_capacity = (capacity << 1);
+
+			node<_Key, _Value>* n_nodes = new node<_Key, _Value>[n_capacity];
+			for (size_t i = 0; i < n_capacity; i++)
+				n_nodes[i] = node<_Key, _Value>();
+
+			for (size_t i = 0; i < capacity; i++)
+			if (nodes[i].state == node_state::IN_USE) {
+				size_t index;
+				put(nodes[i].key, index, n_nodes, n_capacity);
+				n_nodes[index].value = nodes[i].value;
+			}
+
+			delete[] nodes;
+
+			nodes = n_nodes;
+			capacity = n_capacity;
+		}
+
+		bool put(const _Key& key, size_t& index, node<_Key, _Value>* nodes, size_t nodes_length) {
+			index = get_index(key, nodes_length);
+
+			for (size_t i = 0; i < nodes_length; i++) {
+				if (nodes[index].state == node_state::FREE
+					|| nodes[index].state == node_state::ERASED) {
+					nodes[index].key = key;
+					nodes[index].state = node_state::IN_USE;
+					nodes[index].value = 0;
+					return true;
+				}
+
+				if (nodes[index].key == key)
+					return false;
+
+				index++;
+				if (index == nodes_length)
+					index = 0;
+			}
+
+			throw std::logic_error("Unexpected case.");
+		}
+
+		_Hash h;
+	};
+
+}


Fix one overflow and one signedness error, caused by the patch to calculate OLDSERXID_MAX_PAGE based on BLCKSZ. MSVC compiler warned about these.

--- src/backend/storage/lmgr/predicate.c
+++ src/backend/storage/lmgr/predicate.c
@@ -311,7 +311,7 @@
  * transactions and the maximum that SLRU supports.
  */
 #define OLDSERXID_MAX_PAGE			Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
-										(MaxTransactionId + 1) / OLDSERXID_ENTRIESPERPAGE - 1)
+										(MaxTransactionId) / OLDSERXID_ENTRIESPERPAGE)

 #define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)

@@ -767,7 +767,7 @@
 	diff = p - q;
 	if (diff >= ((OLDSERXID_MAX_PAGE + 1) / 2))
 		diff -= OLDSERXID_MAX_PAGE + 1;
-	else if (diff < -((OLDSERXID_MAX_PAGE + 1) / 2))
+	else if (diff < -((int) (OLDSERXID_MAX_PAGE + 1) / 2))
 		diff += OLDSERXID_MAX_PAGE + 1;
 	return diff < 0;
 }


Implement newly added color classes. Remove unused function & declaration.

--- src/bin/e_int_config_color_classes.c
+++ src/bin/e_int_config_color_classes.c
@@ -50,6 +50,8 @@
      {"menu_title",         N_("Menu Title")},
      {"menu_title_active",  N_("Menu Title Active")},
      {"menu_item",          N_("Menu Item")},
+     {"move_text",          N_("Move Text")},
+     {"resize_text",        N_("Resize Text")},
      {NULL, NULL}
 };

@@ -61,6 +63,7 @@
      {"check_text",           N_("Check Text")},
      {"check_text_disabled",  N_("Check Text Disabled")},
      {"entry_text",           N_("Entry Text")},
+     {"label_text",           N_("Label Text")},
      {"ilist_item",           N_("List Item Text")},
      {"ilist_item_odd",       N_("List Item Odd Text")},
      {"ilist_header",         N_("List Header")},
@@ -78,6 +81,7 @@
      {"cpufreq_label",     N_("Cpufreq Label")},
      {"ibar_label",        N_("IBar Label")},
      {"ibox_label",        N_("IBox Label")},
+     {"pager_label",       N_("Pager Label")},
      {"temperature_label", N_("Temperature Label")},
      {NULL, NULL}
 };
@@ -91,7 +95,6 @@

 static void         _fill_data_hash       (E_Config_Dialog_Data *cfdata, const CFColor_Hash *cfhash);
 static void         _fill_data_basic      (E_Config_Dialog_Data *cfdata);
-static void         _fill_data_adv        (E_Config_Dialog_Data *cfdata);

 static void         _load_color_classes   (Evas_Object *obj, E_Config_Dialog_Data *cfdata);
 static void         _radio_cb_change      (void *data, Evas_Object *obj, void *event_info);
@@ -245,8 +248,18 @@
      }
 }

-static void
-_fill_data_adv(E_Config_Dialog_Data *cfdata)
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+   E_Config_Dialog_Data *cfdata;
+
+   cfdata = E_NEW(E_Config_Dialog_Data, 1);
+   _fill_data(cfdata);
+   return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
    while (cfdata->classes)
      {
@@ -261,37 +274,6 @@

 	cfdata->classes = evas_list_remove_list(cfdata->classes, cfdata->classes);
      }
-   _fill_data_hash(cfdata, _wm_hash);
-   _fill_data_hash(cfdata, _wid_hash);
-   _fill_data_hash(cfdata, _mod_hash);
-}
-
-static void *
-_create_data(E_Config_Dialog *cfd)
-{
-   E_Config_Dialog_Data *cfdata;
-
-   cfdata = E_NEW(E_Config_Dialog_Data, 1);
-   _fill_data(cfdata);
-   return cfdata;
-}
-
-static void
-_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
-{
-   while (cfdata->classes)
-     {
-	CFColor_Class *cfc;
-
-	cfc = cfdata->classes->data;
-	if (!cfc) continue;
-	if (cfc->name)
-	  evas_stringshare_del(cfc->name);
-	if (cfc->key)
-	  evas_stringshare_del(cfc->key);
-
-	cfdata->classes = evas_list_remove_list(cfdata->classes, cfdata->classes);
-     }
    E_FREE(cfdata->color1);
    E_FREE(cfdata->color2);
    E_FREE(cfdata->color3);
@@ -419,8 +401,6 @@
    Evas_Object *o, *of, *ob, *ot;
    E_Radio_Group *rg;
    Evas_List *l;
-
-//   _fill_data_adv(cfdata);

    o = e_widget_list_add(evas, 0, 0);
    ot = e_widget_table_add(evas, 1);