lkml.org 
[lkml]   [1996]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: ncr53c8xx.c dependancy problem

On Tue, 3 Dec 1996, Kevin Lentin wrote:

> #include <linux/version.h>
> #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0)
> #include "linux/blk.h"
> #else
> #include "../block/blk.h"
> #endif
>
> breaks mkdep.c on the second dependancy as we already know but the first is
> wrong too. It should be in <> not in "".

It's not _optimal_ indeed, but it's not wrong per se - "header.h" will
search into the current directory first, then into all the directories
<header.h> would search.

The following patch (which includes my previous patch for mkdep) makes
mkdep's behavior more consistent with cpp's behavior.

NOTE: I'm not encouraging #include's like the one above!

NOTE #2: there is no penalty for the default/most common case.


Ionut

--
It is better to keep your mouth shut and be thought a fool,
than to open it and remove all doubt.

--- linux/scripts/mkdep.c.old Sun Dec 1 15:24:50 1996
+++ linux/scripts/mkdep.c Tue Dec 3 19:36:03 1996
@@ -24,8 +24,9 @@
static void handle_include(int type, char *name, int len)
{
int plen;
- struct path_struct *path = path_array+type;
+ struct path_struct *path;

+new_path:
if (!type) {
if (memcmp(name, "linux/", 6) &&
memcmp(name, "asm/", 4) &&
@@ -36,10 +37,16 @@
hasconfig = 1;
}

+ path = path_array + type;
plen = path->len;
memcpy(path->buffer+plen, name, len);
- len += plen;
- path->buffer[len] = '\0';
+ path->buffer[len + plen] = '\0';
+ if (access(path->buffer, F_OK))
+ if (type) {
+ type--;
+ goto new_path;
+ } else
+ return;

if (!hasdep) {
hasdep = 1;


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.022 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site