[jp] Re: problem in todo.c, proposed fix

Judd Montgomery judd at jpilot.org
Fri Mar 14 01:47:51 EST 2003


After getting some rest I will correct myself.

The if statement, which was just an assignment at 297 is just cruft that 
should have been removed.  The extra assignments at 308-310 are 
neccessary because calling the function jp_pc_write("ToDoDB", &br) 
changes br.unique_id and it must be passed back to the calling function.

So, from 0.99.5 the patch is just to remove the offending line.

--- jpilot-0.99.5/todo.c        Thu Feb 13 16:46:38 2003
+++ todo.c      Fri Mar 14 01:32:47 2003
@@ -294,7 +294,6 @@
        br.unique_id = 0;
     }

-   *unique_id = br.unique_id;
  #ifdef ENABLE_MANANA
     get_pref(PREF_MANANA_MODE, &ivalue, NULL);
     if (ivalue) {

Judd

Judd Montgomery wrote:
> You are right, this is redundant code and it is in todo.c, memo.c, 
> datebook.c and address.c.  I'dd be out most of tomorrow, but I'll fix it 
> and check it in.
> 
> Judd
> 
> Dave Sp wrote:
> 
>> If I read your suggestion correctly, you are proposing the code in
>> "todo.c", function "pc_todo_write", to:
>>
>>    /* Keep unique ID intact */
>>    if (unique_id) {
>>       br.unique_id = *unique_id;
>>    } else {
>>       br.unique_id = 0;
>>    }
>>
>>    if (unique_id) {
>>       *unique_id = br.unique_id;
>>    }
>>
>> If unique_id == NULL, it doesn't get used and nothing gets assigned to 
>> it.
>> If unique_id != NULL, it's dereferenced value is assigned to br.unique_id
>> and then br.unique_id is assigned back to *unique_id .
>>
>> It seems to me the second part of the above code isn't needed, 
>> reducing the
>> code segment to just:
>>
>>    /* Keep unique ID intact */
>>    if (unique_id) {
>>       br.unique_id = *unique_id;
>>    } else {
>>       br.unique_id = 0;
>>    }
>>
>> Which also means that, after the subsequent "#ifdef ENABLE_MANANA ...
>> #endif", the check and assignment involving unique_id (lines 308-310 in
>> jpilot-0.99.5/todo.c) can also be eliminated.
>>
>> Am I missing some subtlety?
>>
>>
>>   moc.tenx at psevad  \  yelsnepS evaD  |  Dave Spensley  /  davesp at xnet.com
>>       "I bought the Star Trek chess set and the Civil War chess set.
>>             O-   Now I have the South fight the Klingons."   O-
>>



More information about the Jpilot mailing list