matheus ribeiro wrote:
> Just some food for thought. I was just looking at this function, and it
> seems to me muscle library should have a separate function to retrieve
> number of tokens.

This is inspired by the PC/SC implementation of SCardListReaders. This
function does it in the same way. This is the historical reason. A new
function would clarify the code ... maybe convenient.

Karsten

> 
> For example, to allocate tokenList, you have to call MSCListToken twice.
> The first one to discover the number of tokens and the second one to
> fill the struct. From muscleTool.c (inside doListTokens):
> 
> ===========================================
>     rv = MSCListTokens(MSC_LIST_KNOWN, tokenList, &tokenSize); //1st call
>     CHECK_ERR(rv != MSC_SUCCESS, "ListTokens Failed !");
> 
>     if (tokenSize == 0)
>     {
>         printf("No Valid Tokens Found\n");
>         return;
>     }
> 
>     tokenList = (MSCLPTokenInfo) malloc(sizeof(MSCTokenInfo) * tokenSize);
>     CHECK_ERR(tokenList == 0, "Malloc Failed");
>     rv = MSCListTokens(MSC_LIST_KNOWN, tokenList, &tokenSize); // 2nd call
>     CHECK_ERR(rv != MSC_SUCCESS, "ListTokens Failed !");
> ========================================
> 
> Wouldnt it be better if we had a separate function, say MSCGetNumTokens?
> 
> Matheus
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to