]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Make canned responsed const
authorhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 25 Oct 2009 09:58:23 +0000 (09:58 +0000)
committerhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Sun, 25 Oct 2009 09:58:23 +0000 (09:58 +0000)
armsrc/legicrf.c

index 6a40b037cf63eb3c6cfa1f19fd4cb2df557bc5f6..30e2a9750a509ac261562a59451f313dc3367620 100644 (file)
@@ -16,11 +16,11 @@ static struct legic_frame {
        uint16_t data;
 } current_frame;
 
        uint16_t data;
 } current_frame;
 
-static struct legic_frame queries[] = {
+static const struct legic_frame queries[] = {
                {7, 0x55}, /* 1010 101 */
 };
 
                {7, 0x55}, /* 1010 101 */
 };
 
-static struct legic_frame responses[] = {
+static const struct legic_frame responses[] = {
                {6, 0x3b}, /* 1101 11 */
 };
 
                {6, 0x3b}, /* 1101 11 */
 };
 
@@ -55,18 +55,19 @@ static void frame_send(uint16_t response, int bits)
 static void frame_respond(struct legic_frame const * const f)
 {
        LED_D_ON();
 static void frame_respond(struct legic_frame const * const f)
 {
        LED_D_ON();
-       int i;
-       struct legic_frame *r = NULL;
+       int i, r_size;
+       uint16_t r_data;
        
        for(i=0; i<sizeof(queries)/sizeof(queries[0]); i++) {
                if(f->bits == queries[i].bits && f->data == queries[i].data) {
        
        for(i=0; i<sizeof(queries)/sizeof(queries[0]); i++) {
                if(f->bits == queries[i].bits && f->data == queries[i].data) {
-                       r = &responses[i];
+                       r_data = responses[i].data;
+                       r_size = responses[i].bits;
                        break;
                }
        }
        
                        break;
                }
        }
        
-       if(r != NULL) {
-               frame_send(r->data, r->bits);
+       if(r_size != 0) {
+               frame_send(r_data, r_size);
                LED_A_ON();
        } else {
                LED_A_OFF();
                LED_A_ON();
        } else {
                LED_A_OFF();
Impressum, Datenschutz