1
0
mirror of https://github.com/agdsn/ancient-weatherstation.git synced 2026-06-19 23:07:59 +00:00

make code more readeable

git-svn-id: file:///home/jan/tmp/wetterstation/trunk@18 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
losinshi
2006-08-15 08:55:04 +00:00
parent 55290ad359
commit 33a1feb516
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ int read_port(){
temp = buffer; /* Temporärer Zeiger bekommt die Anfangsaddresse vom Puffer */
add_clean(clean_port, &fd);
add_clean(clean_port, &fd); /* Callbackfunktion zum Aufräumen registrieren */
DEBUGOUT1("\nWarte auf Daten\n\n");
+6 -3
View File
@@ -119,10 +119,10 @@ static int pg_connect(){
conn_string = malloc(sizeof(char)*255);
snprintf(conn_string, 255, "host=%s dbname=%s user=%s password=%s", global_opts.pg_host, global_opts.pg_database, global_opts.pg_user, global_opts.pg_pass);
}
connection = PQconnectdb(conn_string);
add_clean(clean_write, connection);
connection = PQconnectdb(conn_string); /* Connection aufbauen */
add_clean(clean_write, connection); /* Callbackfunktion zum Aufräumen registrieren */
} else {
PQreset(connection);
PQreset(connection); /* Connecion resetten */
}
if(PQstatus(connection) != CONNECTION_OK){
DEBUGOUT2("\nFehler beim Aufbau der Datenbankverbindung\n%s\n", PQerrorMessage(connection));
@@ -137,6 +137,7 @@ static int pg_connect(){
return 1;
}
/* Ein Datum in die Datenbank schreiben */
static void pg_insert(char *query){
PGresult *res;
if(pg_connect()){
@@ -154,6 +155,8 @@ static void pg_insert(char *query){
}
}
/* Callbackfunktion zum Aufräume.
* Schliesst die Verbindung zur Datenbank */
static void clean_write(void *data){
PGconn *conn = data;
PQfinish(conn);