use memcpy instead of copying field by field
[psensor.git] / src / lib / measure.c
index 7dcacc3..28de019 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2010-2011 wpitchoune@gmail.com
+    Copyright (C) 2010-2011 jeanfi@gmail.com
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+
 #include "measure.h"
 
 struct measure *measures_create(int size)
@@ -43,6 +45,5 @@ void measures_free(struct measure *measures)
 
 void measure_copy(struct measure *src, struct measure *dst)
 {
-       dst->time = src->time;
-       dst->value = src->value;
+       memcpy(dst, src, sizeof(struct measure));
 }