Conventions on struct copying?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm still working on the struct object_id patches, and I had a style
question.  In several places throughout the code, we do something like
this:

  unsigned char a[20], b[20];

  /* do some stuff with b */
  hashcpy(a, b);

I could implement an oidcpy that does the same thing.

  struct object_id a, b;

  /* do some stuff with b */
  oidcpy(&a, &b);

Or I could just write that as:

  a = b;

and let the compiler do the heavy lifting.  Is there any reason that
we'd want the function for that purpose, or is it okay to just use the
assignment?  I don't know of any place we explicitly copy structs like
this, but I don't know of any prohibition against it, either.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]