contrib / coccinelle / object_id.coccion commit Merge branch 'nd/switch-and-restore' (f496b06)
   1@@
   2struct object_id OID;
   3@@
   4- is_null_sha1(OID.hash)
   5+ is_null_oid(&OID)
   6
   7@@
   8struct object_id *OIDPTR;
   9@@
  10- is_null_sha1(OIDPTR->hash)
  11+ is_null_oid(OIDPTR)
  12
  13@@
  14struct object_id OID;
  15@@
  16- sha1_to_hex(OID.hash)
  17+ oid_to_hex(&OID)
  18
  19@@
  20identifier f != oid_to_hex;
  21struct object_id *OIDPTR;
  22@@
  23  f(...) {<...
  24- sha1_to_hex(OIDPTR->hash)
  25+ oid_to_hex(OIDPTR)
  26  ...>}
  27
  28@@
  29expression E;
  30struct object_id OID;
  31@@
  32- sha1_to_hex_r(E, OID.hash)
  33+ oid_to_hex_r(E, &OID)
  34
  35@@
  36identifier f != oid_to_hex_r;
  37expression E;
  38struct object_id *OIDPTR;
  39@@
  40   f(...) {<...
  41- sha1_to_hex_r(E, OIDPTR->hash)
  42+ oid_to_hex_r(E, OIDPTR)
  43  ...>}
  44
  45@@
  46struct object_id OID;
  47@@
  48- hashclr(OID.hash)
  49+ oidclr(&OID)
  50
  51@@
  52identifier f != oidclr;
  53struct object_id *OIDPTR;
  54@@
  55  f(...) {<...
  56- hashclr(OIDPTR->hash)
  57+ oidclr(OIDPTR)
  58  ...>}
  59
  60@@
  61struct object_id OID1, OID2;
  62@@
  63- hashcmp(OID1.hash, OID2.hash)
  64+ oidcmp(&OID1, &OID2)
  65
  66@@
  67identifier f != oidcmp;
  68struct object_id *OIDPTR1, OIDPTR2;
  69@@
  70  f(...) {<...
  71- hashcmp(OIDPTR1->hash, OIDPTR2->hash)
  72+ oidcmp(OIDPTR1, OIDPTR2)
  73  ...>}
  74
  75@@
  76struct object_id *OIDPTR;
  77struct object_id OID;
  78@@
  79- hashcmp(OIDPTR->hash, OID.hash)
  80+ oidcmp(OIDPTR, &OID)
  81
  82@@
  83struct object_id *OIDPTR;
  84struct object_id OID;
  85@@
  86- hashcmp(OID.hash, OIDPTR->hash)
  87+ oidcmp(&OID, OIDPTR)
  88
  89@@
  90struct object_id *OIDPTR1;
  91struct object_id *OIDPTR2;
  92@@
  93- oidcmp(OIDPTR1, OIDPTR2) == 0
  94+ oideq(OIDPTR1, OIDPTR2)
  95
  96@@
  97identifier f != hasheq;
  98expression E1, E2;
  99@@
 100  f(...) {<...
 101- hashcmp(E1, E2) == 0
 102+ hasheq(E1, E2)
 103  ...>}
 104
 105@@
 106struct object_id *OIDPTR1;
 107struct object_id *OIDPTR2;
 108@@
 109- oidcmp(OIDPTR1, OIDPTR2) != 0
 110+ !oideq(OIDPTR1, OIDPTR2)
 111
 112@@
 113identifier f != hasheq;
 114expression E1, E2;
 115@@
 116  f(...) {<...
 117- hashcmp(E1, E2) != 0
 118+ !hasheq(E1, E2)
 119  ...>}