Simplify DTMF_FindContact
This commit is contained in:
19
app/dtmf.c
19
app/dtmf.c
@@ -149,22 +149,15 @@ bool DTMF_GetContact(const int Index, char *pContact)
|
|||||||
|
|
||||||
bool DTMF_FindContact(const char *pContact, char *pResult)
|
bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||||
{
|
{
|
||||||
char Contact[16];
|
pResult[0] = 0;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_DTMF_CONTACTS; i++)
|
for (unsigned int i = 0; i < MAX_DTMF_CONTACTS; i++) {
|
||||||
{
|
char Contact[16];
|
||||||
unsigned int j;
|
if (!DTMF_GetContact(i, Contact)) {
|
||||||
|
|
||||||
if (!DTMF_GetContact(i, Contact))
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
if (memcmp(pContact, Contact + 8, 3) == 0) {
|
||||||
if (pContact[j] != Contact[j + 8])
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (j == 3)
|
|
||||||
{
|
|
||||||
memcpy(pResult, Contact, 8);
|
memcpy(pResult, Contact, 8);
|
||||||
pResult[8] = 0;
|
pResult[8] = 0;
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user