summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-02-22 22:32:14 +0100
committerNao Pross <naopross@thearcway.org>2018-02-22 22:32:14 +0100
commit46a617a1b68b8b21eda9e590915dd813ea44e7cb (patch)
treec3618230647561db0373fb69f67cfb7b75631086 /src
parentUpdate doc (diff)
downloadXilofono-46a617a1b68b8b21eda9e590915dd813ea44e7cb.tar.gz
Xilofono-46a617a1b68b8b21eda9e590915dd813ea44e7cb.zip
Add const to MIDI pkt pointer arguments
Diffstat (limited to '')
-rw-r--r--src/main.c2
-rw-r--r--src/midi.c4
-rw-r--r--src/midi.h6
-rw-r--r--src/rs232.c3
4 files changed, 4 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index c6a2a96..c01cb90 100644
--- a/src/main.c
+++ b/src/main.c
@@ -78,7 +78,7 @@
#include <stdlib.h>
#include <string.h>
-int eusart_write_midi(midi_message_t *pkt)
+int eusart_write_midi(const midi_message_t *pkt)
{
size_t length;
uint8_t *data;
diff --git a/src/midi.c b/src/midi.c
index e82c921..b81cf2d 100644
--- a/src/midi.c
+++ b/src/midi.c
@@ -14,17 +14,15 @@ midi_message_t *midi_alloc_message(size_t data_size)
void midi_free_message(midi_message_t *pkt)
{
-#ifndef MIDI_UNSAFE
if (pkt == NULL) {
return;
}
-#endif
free(pkt);
pkt = NULL;
}
-size_t midi_message_size(midi_message_t *pkt)
+size_t midi_message_size(const midi_message_t *pkt)
{
if (pkt == NULL) {
return 0;
diff --git a/src/midi.h b/src/midi.h
index cab35e3..fb85833 100644
--- a/src/midi.h
+++ b/src/midi.h
@@ -59,14 +59,13 @@ typedef struct {
// allocation / dellocation
extern midi_message_t *midi_alloc_message(size_t data_size);
-extern void midi_free_message(midi_message_t *pkt);
-extern size_t midi_message_size(midi_message_t *pkt);
+extern void midi_free_message(const midi_message_t *pkt);
+extern size_t midi_message_size(const midi_message_t *pkt);
#endif
// helper functions
-
extern int midi_set_status(midi_message_t *pkt, midi_status_t status);
extern int midi_set_channel(midi_message_t *pkt, unsigned channel);
@@ -77,6 +76,5 @@ extern int midi_note_off(midi_message_t *pkt, unsigned channel, midi_note_t note
// optimization
// extern int midi_thin_data(void *buffer, midi_message_t pkt[]);
-
#endif /* MIDI_H */
diff --git a/src/rs232.c b/src/rs232.c
index 05d8b22..e87e49b 100644
--- a/src/rs232.c
+++ b/src/rs232.c
@@ -3,7 +3,6 @@
void eusart_init(void)
{
-
// set Async and 8 bits frame
TXSTAbits.SYNC = 0;
TXSTAbits.TX9 = 0;
@@ -23,14 +22,12 @@ void eusart_init(void)
void putch(char c)
{
-
while (!TXIF);
TXREG = c;
}
char getch(void)
{
-
while (!RCIF);
return RCREG;
}