> This might be rather picky, but some projects mandate that static
> vars be declared before non-static vars, and separated from the
> latter. Can't tell whether sigrok is similarly strict. Just
> saying ...
Done. Moved static-const arrays to top of scope.
From e061542667d554adf0b2e548410210c71815a248 Mon Sep 17 00:00:00 2001
From: Richard <rsa...@rsaxvc.net>
Date: Wed, 28 Jun 2017 00:22:46 -0500
Subject: [PATCH 1/4] Mark some arrays as const
---
src/hardware/testo/protocol.c | 2 +-
src/hardware/victor-dmm/protocol.c | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/hardware/testo/protocol.c b/src/hardware/testo/protocol.c
index 396612fd..92bb286e 100644
--- a/src/hardware/testo/protocol.c
+++ b/src/hardware/testo/protocol.c
@@ -170,8 +170,8 @@ SR_PRIV int testo_request_packet(const struct sr_dev_inst *sdi)
* Testo 175/177/400/650/950/435/635/735/445/645/945/946/545. */
SR_PRIV gboolean testo_check_packet_prefix(unsigned char *buf, int len)
{
+ static const unsigned char check[] = { 0x21, 0, 0, 0, 1 };
int i;
- unsigned char check[] = { 0x21, 0, 0, 0, 1 };
if (len < 5)
return FALSE;
diff --git a/src/hardware/victor-dmm/protocol.c b/src/hardware/victor-dmm/protocol.c
index 13a9befa..975b9afe 100644
--- a/src/hardware/victor-dmm/protocol.c
+++ b/src/hardware/victor-dmm/protocol.c
@@ -269,13 +269,14 @@ static void decode_buf(struct sr_dev_inst *sdi, unsigned char *data)
SR_PRIV int victor_dmm_receive_data(struct sr_dev_inst *sdi, unsigned char *buf)
{
+ static const unsigned char obfuscation[DMM_DATA_SIZE] = "jodenxunickxia";
+ static const unsigned char shuffle[DMM_DATA_SIZE] = {
+ 6, 13, 5, 11, 2, 7, 9, 8, 3, 10, 12, 0, 4, 1
+ };
+
GString *dbg;
int i;
unsigned char data[DMM_DATA_SIZE];
- unsigned char obfuscation[DMM_DATA_SIZE] = "jodenxunickxia";
- unsigned char shuffle[DMM_DATA_SIZE] = {
- 6, 13, 5, 11, 2, 7, 9, 8, 3, 10, 12, 0, 4, 1
- };
for (i = 0; i < DMM_DATA_SIZE && buf[i] == 0; i++);
if (i == DMM_DATA_SIZE) {
--
2.11.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel