Miscellaneous coding style fixes:

  • Changes null, true and false to upper case
  • Changes while (...) {} (on one line) to while (...);
  • Removes a closing ?> at end of the file
  • Changes if (..) {...} in template files to if (...): ... endif;

Cheers,
Stella

CommentFileSizeAuthor
#3 coding_style_misc.patch9.35 KBstella
coding_style_misc.patch10.78 KBstella
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

I will RTBC this if it passes the bot.

However, reading the patch suggests to me that drupal_truncate_bytes needs a small refactor for clarity. The while line corrected by this patch is clear as mud.

Here's the full function (as patched):

function drupal_truncate_bytes($string, $len) {
  if (strlen($string) <= $len) {
    return $string;
  }
  if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
    return substr($string, 0, $len);
  }
  while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0);
  return substr($string, 0, $len);
}

I cannot tell from reading the code what that second while statement actually _does_.

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

As promised.

stella’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
9.35 KB

Re-rolled version, added in comment to clarify the while (...); line in unicode.inc. Also removed the endif; changes to the two tpl.php files - will open a separate issue for those.

stella’s picture

Status: Needs review » Reviewed & tested by the community

endif in template files was patched in #471206: coding style fixes - if statement in template files.

Resetting this to RTBC since testing bot passed it, and not much else has changed.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.